From c6587aeb11920b33af3c1f568413c3c63f336312 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 1 Aug 2014 12:52:43 +0000 Subject: [PATCH] Test of cachefile should be done in /tmp git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1654 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- Tests/cachefileTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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"); } }