Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)

This commit is contained in:
2023-04-13 22:22:46 +02:00
parent b017700d0a
commit 273db5f183
51 changed files with 3926 additions and 3637 deletions

View File

@@ -1,33 +1,35 @@
<?php
/** DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
* @license BSD
*/
/**
* DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
* @license BSD
*/
namespace Domframework\Tests;
use Domframework\Certificationauthority;
/** Test the certification Authority
*/
/**
* Test the certification Authority
*/
class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
{
public function test_createCA_1()
public function testCreateCA1()
{
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
$caCert = explode("\n", $certificationauthority->caCert());
$caKey = explode("\n", $certificationauthority->caKey());
$res = $caCert[0] . $caKey[0];
$res = $caCert[0] . $caKey[0];
$this->assertSame(
$res,
"-----BEGIN CERTIFICATE----------BEGIN PRIVATE KEY-----"
);
}
public function test_createCA_2()
public function testCreateCA2()
{
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
@@ -42,7 +44,7 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, 1);
}
public function test_createPK_1()
public function testCreatePK1()
{
$certificationauthority = new Certificationauthority();
$privateKey = $certificationauthority->createPrivateKey() -> privateKey();
@@ -50,7 +52,7 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($privateKey[0], "-----BEGIN PRIVATE KEY-----");
}
public function test_createCSR_1()
public function testCreateCSR1()
{
$certificationauthority = new Certificationauthority();
$csr = $certificationauthority->createCSR("FR", "FOURNIER38", "CSR");
@@ -58,7 +60,7 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($csr[0], "-----BEGIN CERTIFICATE REQUEST-----");
}
public function test_signCSR_1()
public function testSignCSR1()
{
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
@@ -70,7 +72,7 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($cert[0], "-----BEGIN CERTIFICATE-----");
}
public function test_signCSR_2()
public function testSignCSR2()
{
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
@@ -88,9 +90,9 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, 1);
}
public function test_signCSR_3()
public function testSignCSR3()
{
// Check if generated cert X509v3 Extended Key Usage are valid
// Check if generated cert X509v3 Extended Key Usage are valid
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
$caCert = $certificationauthority->caCert();
@@ -107,9 +109,9 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, 1);
}
public function test_signCSR_4()
public function testSignCSR4()
{
// Check if generated cert issuer name is valid
// Check if generated cert issuer name is valid
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
$caCert = $certificationauthority->caCert();
@@ -126,9 +128,9 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, 1);
}
public function test_signCSR_5()
public function testSignCSR5()
{
// Check if generated cert is not tagged CA
// Check if generated cert is not tagged CA
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
$caCert = $certificationauthority->caCert();
@@ -145,9 +147,9 @@ class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, 1);
}
public function test_signCSR_6()
public function testSignCSR6()
{
// Check if generated cert has Alternative Names
// Check if generated cert has Alternative Names
$certificationauthority = new Certificationauthority();
$certificationauthority->createCA("FR", "FOURNIER38", "CATEST");
$caCert = $certificationauthority->caCert();