Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)
This commit is contained in:
@@ -1,96 +1,99 @@
|
||||
<?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\Userssql;
|
||||
|
||||
/** Test the Userssql.php file */
|
||||
/**
|
||||
* Test the Userssql.php file
|
||||
*/
|
||||
class UserssqlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_clean()
|
||||
public function testClean()
|
||||
{
|
||||
@unlink("/tmp/database.db");
|
||||
}
|
||||
|
||||
public function test_initStorage()
|
||||
public function testInitStorage()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->initStorage();
|
||||
$this->assertSame($res, 0);
|
||||
}
|
||||
|
||||
public function test_listusers1()
|
||||
public function testListusers1()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array ());
|
||||
$this->assertSame($res, []);
|
||||
}
|
||||
|
||||
public function test_adduser1()
|
||||
public function testAdduser1()
|
||||
{
|
||||
$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()
|
||||
public function testListusers2()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array (array ("email" => "toto@toto.com",
|
||||
$this->assertSame($res, [["email" => "toto@toto.com",
|
||||
"firstname" => "Toto",
|
||||
"lastname" => "Toto2")));
|
||||
"lastname" => "Toto2"]]);
|
||||
}
|
||||
|
||||
public function test_overwritepassword1()
|
||||
public function testOverwritepassword1()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->overwritepassword("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame($res, 1);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword1()
|
||||
public function testCheckValidPassword1()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame($res, true);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword2()
|
||||
public function testCheckValidPassword2()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword("toto@toto.com", "BAD PASSWD");
|
||||
$this->assertSame($res, false);
|
||||
}
|
||||
|
||||
public function test_changepassword1()
|
||||
public function testChangepassword1()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->changepassword("toto@toto.com", "PassW0rd", "NEW PASS!");
|
||||
$this->assertSame($res, 1);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword3()
|
||||
public function testCheckValidPassword3()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword("toto@toto.com", "PassW0rd");
|
||||
$this->assertSame($res, false);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword4()
|
||||
public function testCheckValidPassword4()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword("toto@toto.com", "NEW PASS!");
|
||||
$this->assertSame($res, true);
|
||||
}
|
||||
|
||||
public function test_updateuser()
|
||||
public function testUpdateuser()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->updateuser(
|
||||
@@ -102,33 +105,33 @@ class UserssqlTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame($res, 1);
|
||||
}
|
||||
|
||||
public function test_listusers3()
|
||||
public function testListusers3()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array (array ("email" => "titi@titi.com",
|
||||
$this->assertSame($res, [["email" => "titi@titi.com",
|
||||
"firstname" => "titi",
|
||||
"lastname" => "titi2")));
|
||||
"lastname" => "titi2"]]);
|
||||
}
|
||||
|
||||
public function test_checkValidPassword5()
|
||||
public function testCheckValidPassword5()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->checkValidPassword("titi@titi.com", "NEW PASS!");
|
||||
$this->assertSame($res, true);
|
||||
}
|
||||
|
||||
public function test_deluser()
|
||||
public function testDeluser()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->deluser("titi@titi.com");
|
||||
$this->assertSame($res, 1);
|
||||
}
|
||||
|
||||
public function test_listusers4()
|
||||
public function testListusers4()
|
||||
{
|
||||
$userssql = new Userssql("sqlite:///tmp/database.db");
|
||||
$res = $userssql->listusers();
|
||||
$this->assertSame($res, array ());
|
||||
$this->assertSame($res, []);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user