PSR12
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
@@ -12,118 +13,122 @@ use Domframework\Userssql;
|
||||
/** Test the Userssql.php file */
|
||||
class UserssqlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_clean ()
|
||||
{
|
||||
@unlink ("/tmp/database.db");
|
||||
}
|
||||
public function test_clean()
|
||||
{
|
||||
@unlink("/tmp/database.db");
|
||||
}
|
||||
|
||||
public function test_initStorage ()
|
||||
{
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->initStorage ();
|
||||
$this->assertSame ($res, 0);
|
||||
}
|
||||
public function test_initStorage()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array ());
|
||||
}
|
||||
public function test_listusers1()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->adduser ("toto@toto.com", "Toto", "Toto2");
|
||||
$this->assertSame ($res, "toto@toto.com");
|
||||
}
|
||||
public function test_adduser1()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array (array ("email"=>"toto@toto.com",
|
||||
"firstname"=>"Toto",
|
||||
"lastname"=>"Toto2")));
|
||||
}
|
||||
public function test_listusers2()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array (array ("email" => "toto@toto.com",
|
||||
"firstname" => "Toto",
|
||||
"lastname" => "Toto2")));
|
||||
}
|
||||
|
||||
public function test_overwritepassword1 ()
|
||||
{
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->overwritepassword ("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
public function test_overwritepassword1()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
public function test_checkValidPassword1()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "BAD PASSWD");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
public function test_checkValidPassword2()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->changepassword ("toto@toto.com", "PassW0rd", "NEW PASS!");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
public function test_changepassword1()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
public function test_checkValidPassword3()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->checkValidPassword ("toto@toto.com", "NEW PASS!");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
public function test_checkValidPassword4()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->updateuser ("toto@toto.com", "titi@titi.com", "titi",
|
||||
"titi2");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
public function test_updateuser()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->updateuser(
|
||||
"toto@toto.com",
|
||||
"titi@titi.com",
|
||||
"titi",
|
||||
"titi2"
|
||||
);
|
||||
$this->assertSame($res, 1);
|
||||
}
|
||||
|
||||
public function test_listusers3 ()
|
||||
{
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array (array ("email"=>"titi@titi.com",
|
||||
"firstname"=>"titi",
|
||||
"lastname"=>"titi2")));
|
||||
}
|
||||
public function test_listusers3()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array (array ("email" => "titi@titi.com",
|
||||
"firstname" => "titi",
|
||||
"lastname" => "titi2")));
|
||||
}
|
||||
|
||||
public function test_checkValidPassword5 ()
|
||||
{
|
||||
$userssql = new Userssql ("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword ("titi@titi.com", "NEW PASS!");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
public function test_checkValidPassword5()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->deluser ("titi@titi.com");
|
||||
$this->assertSame ($res, 1);
|
||||
}
|
||||
public function test_deluser()
|
||||
{
|
||||
$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");
|
||||
$res = $userssql->listusers ();
|
||||
$this->assertSame ($res, array ());
|
||||
}
|
||||
public function test_listusers4()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array ());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user