diff --git a/Tests/cachefileTest.php b/Tests/cachefileTest.php index effc234..90e93a0 100644 --- a/Tests/cachefileTest.php +++ b/Tests/cachefileTest.php @@ -10,6 +10,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase { // Removing the cache file if it previously exists $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->delete ("id"); } @@ -17,6 +18,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase public function testRead1 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->read ("id"); $this->assertFalse ($res); } @@ -25,6 +27,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase public function testWrite1 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->write ("id","DATA_TO_STORE", 3); $this->assertTrue ($res); } @@ -33,6 +36,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase public function testRead2 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->read ("id"); $this->assertEquals ("DATA_TO_STORE", $res); } @@ -47,6 +51,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase public function testRead3 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->read ("id"); $this->assertFalse ($res); } @@ -55,6 +60,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase public function testWrite2 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->write ("id","DATA_TO_STORE", 30); $this->assertTrue ($res); } @@ -62,13 +68,14 @@ class test_cachefile extends PHPUnit_Framework_TestCase // Create stale lock public function testLock1 () { - touch ("cache/".sha1 ("id").".lock"); + touch ("/tmp/cache/".sha1 ("id").".lock"); } // Previous cache in time file but lock : return content after lock timeout public function testRead4 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->read ("id"); $this->assertEquals ("DATA_TO_STORE", $res); } @@ -76,6 +83,7 @@ class test_cachefile extends PHPUnit_Framework_TestCase public function testDel1 () { $c = new cachefile (); + $c->directory = "/tmp/cache"; $res = $c->delete ("id"); } }