Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -7,13 +7,15 @@
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
use Domframework\Certificationauthority;
|
||||
|
||||
/** Test the certification Authority
|
||||
*/
|
||||
class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
class CertificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_createCA_1 ()
|
||||
{
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = explode ("\n", $certificationauthority->caCert ());
|
||||
$caKey = explode ("\n", $certificationauthority->caKey ());
|
||||
@@ -24,7 +26,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_createCA_2 ()
|
||||
{
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
file_put_contents ("/tmp/test_createCA_2", $caCert);
|
||||
@@ -37,7 +39,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_createPK_1 ()
|
||||
{
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$privateKey = $certificationauthority->createPrivateKey () -> privateKey ();
|
||||
$privateKey = explode ("\n", $privateKey);
|
||||
$this->assertSame ($privateKey[0], "-----BEGIN PRIVATE KEY-----");
|
||||
@@ -45,7 +47,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_createCSR_1 ()
|
||||
{
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$csr = $certificationauthority->createCSR ("FR", "FOURNIER38", "CSR");
|
||||
$csr = explode ("\n", $csr);
|
||||
$this->assertSame ($csr[0], "-----BEGIN CERTIFICATE REQUEST-----");
|
||||
@@ -53,7 +55,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_signCSR_1 ()
|
||||
{
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
@@ -65,7 +67,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_signCSR_2 ()
|
||||
{
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
@@ -82,7 +84,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_signCSR_3 ()
|
||||
{
|
||||
// Check if generated cert X509v3 Extended Key Usage are valid
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
@@ -100,7 +102,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_signCSR_4 ()
|
||||
{
|
||||
// Check if generated cert issuer name is valid
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
@@ -117,7 +119,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_signCSR_5 ()
|
||||
{
|
||||
// Check if generated cert is not tagged CA
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
@@ -134,7 +136,7 @@ class certificationauthorityTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_signCSR_6 ()
|
||||
{
|
||||
// Check if generated cert has Alternative Names
|
||||
$certificationauthority = new certificationauthority ();
|
||||
$certificationauthority = new Certificationauthority ();
|
||||
$certificationauthority->createCA ("FR", "FOURNIER38", "CATEST");
|
||||
$caCert = $certificationauthority->caCert ();
|
||||
$caKey = $certificationauthority->caKey ();
|
||||
|
||||
Reference in New Issue
Block a user