Improved object cache testing

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@73058 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-03-15 00:48:33 +00:00
parent bc8cd107db
commit 08e2fc15ef

View File

@ -198,13 +198,16 @@ class ObjectTest extends SapphireTest {
public function testCacheToFile() {
$obj = new ObjectTest_CacheTest();
$this->assertEquals($obj->cacheToFile('cacheMethod', -1), 'noarg');
$this->assertEquals($obj->cacheToFile('cacheMethod', -1, null, array(true)), 'hasarg');
$this->assertEquals($obj->cacheToFile('cacheMethod', 3600, null, array(true)), 'hasarg');
$this->assertEquals('noarg', $obj->cacheToFile('cacheMethod', -1));
$this->assertEquals('hasarg', $obj->cacheToFile('cacheMethod', -1, null, array(true)));
$this->assertEquals('hasarg', $obj->cacheToFile('cacheMethod', 3600, null, array(true)));
$this->assertEquals($obj->cacheToFile('incNumber', -1), 1);
$this->assertEquals($obj->cacheToFile('incNumber', -1), 2);
$this->assertEquals($obj->cacheToFile('incNumber'), 2);
// -1 lifetime will ensure that the cache isn't read - number incremented
$this->assertEquals(1, $obj->cacheToFile('incNumber', -1));
// -1 lifetime will ensure that the cache isn't read - number incremented
$this->assertEquals(2, $obj->cacheToFile('incNumber', -1));
// Number shouldn't be incremented now because we're using the cached version
$this->assertEquals(2, $obj->cacheToFile('incNumber', 3600));
}
public function testExtend() {