Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
/** Test the userssql.php file */
|
||||
class userssqlTest extends \PHPUnit_Framework_TestCase
|
||||
use Domframework\Userssql;
|
||||
|
||||
/** Test the Userssql.php file */
|
||||
class UserssqlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_clean ()
|
||||
{
|
||||
@@ -17,28 +19,28 @@ class userssqlTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_initStorage ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->initStorage ();
|
||||
$this->assertSame ($res, 0);
|
||||
}
|
||||
|
||||
public function test_listusers1 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array ());
|
||||
}
|
||||
|
||||
public function test_adduser1 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->adduser ("toto@toto.com", "Toto", "Toto2");
|
||||
$this->assertSame ($res, "toto@toto.com");
|
||||
}
|
||||
|
||||
public function test_listusers2 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array (array ("email"=>"toto@toto.com",
|
||||
"firstname"=>"Toto",
|
||||
@@ -47,49 +49,49 @@ class userssqlTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_overwritepassword1 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->overwritepassword ("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword1 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword2 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "BAD PASSWD");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
public function test_changepassword1 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->changepassword ("toto@toto.com", "PassW0rd", "NEW PASS!");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword3 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword4 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "NEW PASS!");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_updateuser ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->updateuser ("toto@toto.com", "titi@titi.com", "titi",
|
||||
"titi2");
|
||||
$this->assertSame ($res, 1);
|
||||
@@ -97,7 +99,7 @@ class userssqlTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_listusers3 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array (array ("email"=>"titi@titi.com",
|
||||
"firstname"=>"titi",
|
||||
@@ -106,21 +108,21 @@ class userssqlTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_checkValidPassword5 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword ("titi@titi.com", "NEW PASS!");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_deluser ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->deluser ("titi@titi.com");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
|
||||
public function test_listusers4 ()
|
||||
{
|
||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array ());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user