mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
bc8cd107db
commit
08e2fc15ef
@ -198,13 +198,16 @@ class ObjectTest extends SapphireTest {
|
|||||||
public function testCacheToFile() {
|
public function testCacheToFile() {
|
||||||
$obj = new ObjectTest_CacheTest();
|
$obj = new ObjectTest_CacheTest();
|
||||||
|
|
||||||
$this->assertEquals($obj->cacheToFile('cacheMethod', -1), 'noarg');
|
$this->assertEquals('noarg', $obj->cacheToFile('cacheMethod', -1));
|
||||||
$this->assertEquals($obj->cacheToFile('cacheMethod', -1, null, array(true)), 'hasarg');
|
$this->assertEquals('hasarg', $obj->cacheToFile('cacheMethod', -1, null, array(true)));
|
||||||
$this->assertEquals($obj->cacheToFile('cacheMethod', 3600, null, array(true)), 'hasarg');
|
$this->assertEquals('hasarg', $obj->cacheToFile('cacheMethod', 3600, null, array(true)));
|
||||||
|
|
||||||
$this->assertEquals($obj->cacheToFile('incNumber', -1), 1);
|
// -1 lifetime will ensure that the cache isn't read - number incremented
|
||||||
$this->assertEquals($obj->cacheToFile('incNumber', -1), 2);
|
$this->assertEquals(1, $obj->cacheToFile('incNumber', -1));
|
||||||
$this->assertEquals($obj->cacheToFile('incNumber'), 2);
|
// -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() {
|
public function testExtend() {
|
||||||
|
Loading…
Reference in New Issue
Block a user