Passage en Namespace et tous les tests fonctionnels OK

This commit is contained in:
2021-05-10 11:48:15 +02:00
parent 536dd0d56b
commit eb30d8ef97
56 changed files with 1091 additions and 964 deletions

View File

@@ -7,12 +7,15 @@
namespace Domframework\Tests;
/** Test the authhtpasswd.php file */
class authhtpasswdTest extends \PHPUnit_Framework_TestCase
use Domframework\Authhtpasswd;
/** Test the Authhtpasswd.php file */
class AuthhtpasswdTest extends \PHPUnit_Framework_TestCase
{
public function test_clean ()
{
@unlink ("/tmp/htpasswd.file");
if (file_exists ("/tmp/htpasswd.file"))
unlink ("/tmp/htpasswd.file");
file_put_contents ("/tmp/htpasswd.file",
'toto@toto.com:$2y$05$dO7qyX4simzg3pMgWyqHgeAjFauXEyUdPdyrwDMVNj4fTuE24TGuq'
."\n".
@@ -23,7 +26,7 @@ class authhtpasswdTest extends \PHPUnit_Framework_TestCase
public function test_connect ()
{
$authhtpasswd = new authhtpasswd ();
$authhtpasswd = new Authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$res = $authhtpasswd->connect ();
$this->assertSame ($res, null);
@@ -31,7 +34,7 @@ class authhtpasswdTest extends \PHPUnit_Framework_TestCase
public function test_authentication1 ()
{
$authhtpasswd = new authhtpasswd ();
$authhtpasswd = new Authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$res = $authhtpasswd->authentication ("toto@toto.com", "toto123");
$this->assertSame ($res, true);
@@ -39,7 +42,7 @@ class authhtpasswdTest extends \PHPUnit_Framework_TestCase
public function test_authentication2 ()
{
$authhtpasswd = new authhtpasswd ();
$authhtpasswd = new Authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$this->setExpectedException ("Exception");
$res = $authhtpasswd->authentication ("UNKNOWN@toto.com", "toto123");
@@ -47,7 +50,7 @@ class authhtpasswdTest extends \PHPUnit_Framework_TestCase
public function test_authentication3 ()
{
$authhtpasswd = new authhtpasswd ();
$authhtpasswd = new Authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$this->setExpectedException ("Exception");
$res = $authhtpasswd->authentication ("toto@toto.com", "BAD PASSWD");
@@ -55,7 +58,7 @@ class authhtpasswdTest extends \PHPUnit_Framework_TestCase
public function test_authentication4 ()
{
$authhtpasswd = new authhtpasswd ();
$authhtpasswd = new Authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$res = $authhtpasswd->authentication ("titi@titi.com", "toto123");
$this->assertSame ($res, true);