Test of cachefile should be done in /tmp
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1654 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user