Update unit tests : $this->assertEquals -> $this->assertSame
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2563 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -22,7 +22,7 @@ class test_authhtpasswd extends PHPUnit_Framework_TestCase
|
|||||||
$authhtpasswd = new authhtpasswd ();
|
$authhtpasswd = new authhtpasswd ();
|
||||||
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
|
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
|
||||||
$res = $authhtpasswd->connect ();
|
$res = $authhtpasswd->connect ();
|
||||||
$this->assertEquals ($res, null);
|
$this->assertSame ($res, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_authentication1 ()
|
public function test_authentication1 ()
|
||||||
@@ -30,7 +30,7 @@ class test_authhtpasswd extends PHPUnit_Framework_TestCase
|
|||||||
$authhtpasswd = new authhtpasswd ();
|
$authhtpasswd = new authhtpasswd ();
|
||||||
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
|
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
|
||||||
$res = $authhtpasswd->authentication ("toto@toto.com", "toto123");
|
$res = $authhtpasswd->authentication ("toto@toto.com", "toto123");
|
||||||
$this->assertEquals ($res, true);
|
$this->assertSame ($res, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_authentication2 ()
|
public function test_authentication2 ()
|
||||||
@@ -54,6 +54,6 @@ class test_authhtpasswd extends PHPUnit_Framework_TestCase
|
|||||||
$authhtpasswd = new authhtpasswd ();
|
$authhtpasswd = new authhtpasswd ();
|
||||||
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
|
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
|
||||||
$res = $authhtpasswd->authentication ("titi@titi.com", "toto123");
|
$res = $authhtpasswd->authentication ("titi@titi.com", "toto123");
|
||||||
$this->assertEquals ($res, true);
|
$this->assertSame ($res, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase
|
|||||||
$c = new cachefile ();
|
$c = new cachefile ();
|
||||||
$c->directory = "/tmp/cache";
|
$c->directory = "/tmp/cache";
|
||||||
$res = $c->read ("id");
|
$res = $c->read ("id");
|
||||||
$this->assertEquals ("DATA_TO_STORE", $res);
|
$this->assertSame ("DATA_TO_STORE", $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sleep 3s to expire the cache
|
// Sleep 3s to expire the cache
|
||||||
@@ -77,7 +77,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase
|
|||||||
$c = new cachefile ();
|
$c = new cachefile ();
|
||||||
$c->directory = "/tmp/cache";
|
$c->directory = "/tmp/cache";
|
||||||
$res = $c->read ("id");
|
$res = $c->read ("id");
|
||||||
$this->assertEquals ("DATA_TO_STORE", $res);
|
$this->assertSame ("DATA_TO_STORE", $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDel1 ()
|
public function testDel1 ()
|
||||||
|
|||||||
@@ -15,72 +15,72 @@ class test_userssql extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->initStorage ();
|
$res = $userssql->initStorage ();
|
||||||
$this->assertEquals ($res, 0);
|
$this->assertSame ($res, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_listusers1 ()
|
public function test_listusers1 ()
|
||||||
{
|
{
|
||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->listusers ();
|
$res = $userssql->listusers ();
|
||||||
$this->assertEquals ($res, array ());
|
$this->assertSame ($res, array ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_adduser1 ()
|
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");
|
$res = $userssql->adduser ("toto@toto.com", "Toto", "Toto2");
|
||||||
$this->assertEquals ($res, 1);
|
$this->assertSame ($res, "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_listusers2 ()
|
public function test_listusers2 ()
|
||||||
{
|
{
|
||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->listusers ();
|
$res = $userssql->listusers ();
|
||||||
$this->assertEquals ($res, array (array ("email"=>"toto@toto.com",
|
$this->assertSame ($res, array (array ("email"=>"toto@toto.com",
|
||||||
"firstname"=>"Toto",
|
"firstname"=>"Toto",
|
||||||
"lastname"=>"Toto2")));
|
"lastname"=>"Toto2")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_overwritepassword1 ()
|
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");
|
$res = $userssql->overwritepassword ("toto@toto.com", "PassW0rd");
|
||||||
$this->assertEquals ($res, 1);
|
$this->assertSame ($res, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_checkValidPassword1 ()
|
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");
|
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
|
||||||
$this->assertEquals ($res, true);
|
$this->assertSame ($res, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_checkValidPassword2 ()
|
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");
|
$res = $userssql->checkValidPassword ("toto@toto.com", "BAD PASSWD");
|
||||||
$this->assertEquals ($res, false);
|
$this->assertSame ($res, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_changepassword1 ()
|
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!");
|
$res = $userssql->changepassword ("toto@toto.com", "PassW0rd", "NEW PASS!");
|
||||||
$this->assertEquals ($res, 1);
|
$this->assertSame ($res, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_checkValidPassword3 ()
|
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");
|
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
|
||||||
$this->assertEquals ($res, false);
|
$this->assertSame ($res, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_checkValidPassword4 ()
|
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!");
|
$res = $userssql->checkValidPassword ("toto@toto.com", "NEW PASS!");
|
||||||
$this->assertEquals ($res, true);
|
$this->assertSame ($res, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_updateuser ()
|
public function test_updateuser ()
|
||||||
@@ -88,36 +88,36 @@ class test_userssql extends PHPUnit_Framework_TestCase
|
|||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->updateuser ("toto@toto.com", "titi@titi.com", "titi",
|
$res = $userssql->updateuser ("toto@toto.com", "titi@titi.com", "titi",
|
||||||
"titi2");
|
"titi2");
|
||||||
$this->assertEquals ($res, 1);
|
$this->assertSame ($res, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_listusers3 ()
|
public function test_listusers3 ()
|
||||||
{
|
{
|
||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->listusers ();
|
$res = $userssql->listusers ();
|
||||||
$this->assertEquals ($res, array (array ("email"=>"titi@titi.com",
|
$this->assertSame ($res, array (array ("email"=>"titi@titi.com",
|
||||||
"firstname"=>"titi",
|
"firstname"=>"titi",
|
||||||
"lastname"=>"titi2")));
|
"lastname"=>"titi2")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_checkValidPassword5 ()
|
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!");
|
$res = $userssql->checkValidPassword ("titi@titi.com", "NEW PASS!");
|
||||||
$this->assertEquals ($res, true);
|
$this->assertSame ($res, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_deluser ()
|
public function test_deluser ()
|
||||||
{
|
{
|
||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->deluser ("titi@titi.com");
|
$res = $userssql->deluser ("titi@titi.com");
|
||||||
$this->assertEquals ($res, 1);
|
$this->assertSame ($res, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_listusers4 ()
|
public function test_listusers4 ()
|
||||||
{
|
{
|
||||||
$userssql = new userssql ("sqlite:///tmp/database.db");
|
$userssql = new userssql ("sqlite:///tmp/database.db");
|
||||||
$res = $userssql->listusers ();
|
$res = $userssql->listusers ();
|
||||||
$this->assertEquals ($res, array ());
|
$this->assertSame ($res, array ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user