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:
2016-02-25 08:40:53 +00:00
parent 1ad99a3641
commit 24f99e6a69
3 changed files with 24 additions and 24 deletions

View File

@@ -22,7 +22,7 @@ class test_authhtpasswd extends PHPUnit_Framework_TestCase
$authhtpasswd = new authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$res = $authhtpasswd->connect ();
$this->assertEquals ($res, null);
$this->assertSame ($res, null);
}
public function test_authentication1 ()
@@ -30,7 +30,7 @@ class test_authhtpasswd extends PHPUnit_Framework_TestCase
$authhtpasswd = new authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$res = $authhtpasswd->authentication ("toto@toto.com", "toto123");
$this->assertEquals ($res, true);
$this->assertSame ($res, true);
}
public function test_authentication2 ()
@@ -54,6 +54,6 @@ class test_authhtpasswd extends PHPUnit_Framework_TestCase
$authhtpasswd = new authhtpasswd ();
$authhtpasswd->htpasswdFile = "/tmp/htpasswd.file";
$res = $authhtpasswd->authentication ("titi@titi.com", "toto123");
$this->assertEquals ($res, true);
$this->assertSame ($res, true);
}
}

View File

@@ -38,7 +38,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase
$c = new cachefile ();
$c->directory = "/tmp/cache";
$res = $c->read ("id");
$this->assertEquals ("DATA_TO_STORE", $res);
$this->assertSame ("DATA_TO_STORE", $res);
}
// Sleep 3s to expire the cache
@@ -77,7 +77,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase
$c = new cachefile ();
$c->directory = "/tmp/cache";
$res = $c->read ("id");
$this->assertEquals ("DATA_TO_STORE", $res);
$this->assertSame ("DATA_TO_STORE", $res);
}
public function testDel1 ()

View File

@@ -15,72 +15,72 @@ class test_userssql extends PHPUnit_Framework_TestCase
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->initStorage ();
$this->assertEquals ($res, 0);
$this->assertSame ($res, 0);
}
public function test_listusers1 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->listusers ();
$this->assertEquals ($res, array ());
$this->assertSame ($res, array ());
}
public function test_adduser1 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->adduser ("toto@toto.com", "Toto", "Toto2");
$this->assertEquals ($res, 1);
$this->assertSame ($res, "1");
}
public function test_listusers2 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->listusers ();
$this->assertEquals ($res, array (array ("email"=>"toto@toto.com",
"firstname"=>"Toto",
"lastname"=>"Toto2")));
$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->assertEquals ($res, 1);
$this->assertSame ($res, 1);
}
public function test_checkValidPassword1 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
$this->assertEquals ($res, true);
$this->assertSame ($res, true);
}
public function test_checkValidPassword2 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->checkValidPassword ("toto@toto.com", "BAD PASSWD");
$this->assertEquals ($res, false);
$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->assertEquals ($res, 1);
$this->assertSame ($res, 1);
}
public function test_checkValidPassword3 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->checkValidPassword ("toto@toto.com", "PassW0rd");
$this->assertEquals ($res, false);
$this->assertSame ($res, false);
}
public function test_checkValidPassword4 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->checkValidPassword ("toto@toto.com", "NEW PASS!");
$this->assertEquals ($res, true);
$this->assertSame ($res, true);
}
public function test_updateuser ()
@@ -88,36 +88,36 @@ class test_userssql extends PHPUnit_Framework_TestCase
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->updateuser ("toto@toto.com", "titi@titi.com", "titi",
"titi2");
$this->assertEquals ($res, 1);
$this->assertSame ($res, 1);
}
public function test_listusers3 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->listusers ();
$this->assertEquals ($res, array (array ("email"=>"titi@titi.com",
"firstname"=>"titi",
"lastname"=>"titi2")));
$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->assertEquals ($res, true);
$this->assertSame ($res, true);
}
public function test_deluser ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->deluser ("titi@titi.com");
$this->assertEquals ($res, 1);
$this->assertSame ($res, 1);
}
public function test_listusers4 ()
{
$userssql = new userssql ("sqlite:///tmp/database.db");
$res = $userssql->listusers ();
$this->assertEquals ($res, array ());
$this->assertSame ($res, array ());
}
}