Update the tests for cachefile

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1555 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-07-25 16:12:15 +00:00
parent 0d36aa7b47
commit f08221a9cd

View File

@@ -4,19 +4,19 @@
@author Dominique Fournier <dominique@fournier38.fr> */ @author Dominique Fournier <dominique@fournier38.fr> */
/** Test the cache.php file */ /** Test the cache.php file */
class test_cacheFile extends PHPUnit_Framework_TestCase class test_cachefile extends PHPUnit_Framework_TestCase
{ {
public function __construct () public function __construct ()
{ {
// Removing the cache file if it previously exists // Removing the cache file if it previously exists
$c = new cacheFile (); $c = new cachefile ();
$res = $c->delete ("id"); $res = $c->delete ("id");
} }
// Unknown cache file : return FALSE // Unknown cache file : return FALSE
public function testRead1 () public function testRead1 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->read ("id"); $res = $c->read ("id");
$this->assertFalse ($res); $this->assertFalse ($res);
} }
@@ -24,7 +24,7 @@ class test_cacheFile extends PHPUnit_Framework_TestCase
// Write in cache file // Write in cache file
public function testWrite1 () public function testWrite1 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->write ("id","DATA_TO_STORE", 3); $res = $c->write ("id","DATA_TO_STORE", 3);
$this->assertTrue ($res); $this->assertTrue ($res);
} }
@@ -32,7 +32,7 @@ class test_cacheFile extends PHPUnit_Framework_TestCase
// Previous cache file : return DATA_TO_STORE // Previous cache file : return DATA_TO_STORE
public function testRead2 () public function testRead2 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->read ("id"); $res = $c->read ("id");
$this->assertEquals ("DATA_TO_STORE", $res); $this->assertEquals ("DATA_TO_STORE", $res);
} }
@@ -46,7 +46,7 @@ class test_cacheFile extends PHPUnit_Framework_TestCase
// Previous cache file but expired : return false // Previous cache file but expired : return false
public function testRead3 () public function testRead3 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->read ("id"); $res = $c->read ("id");
$this->assertFalse ($res); $this->assertFalse ($res);
} }
@@ -54,7 +54,7 @@ class test_cacheFile extends PHPUnit_Framework_TestCase
// Write in cache file // Write in cache file
public function testWrite2 () public function testWrite2 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->write ("id","DATA_TO_STORE", 30); $res = $c->write ("id","DATA_TO_STORE", 30);
$this->assertTrue ($res); $this->assertTrue ($res);
} }
@@ -68,14 +68,14 @@ class test_cacheFile extends PHPUnit_Framework_TestCase
// Previous cache in time file but lock : return content after lock timeout // Previous cache in time file but lock : return content after lock timeout
public function testRead4 () public function testRead4 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->read ("id"); $res = $c->read ("id");
$this->assertEquals ("DATA_TO_STORE", $res); $this->assertEquals ("DATA_TO_STORE", $res);
} }
public function testDel1 () public function testDel1 ()
{ {
$c = new cacheFile (); $c = new cachefile ();
$res = $c->delete ("id"); $res = $c->delete ("id");
} }
} }