private function _startNested(CacheAbstract $cache) { $expected = ["first level", "second level 1", "second level 2", "second level 3"]; $i = 0; $data = ''; if (!($data = $cache->start(new CacheKey('startnested', 'first', 0), null, false))) { $this->assertTrue(true); echo $expected[$i++]; if (!$cache->start(new CacheKey('startnested', 'second', $i), null, false)) { echo $expected[$i++]; if (!$cache->start(new CacheKey('startnested', 'second', $i), null, false)) { echo $expected[$i++]; if (!$cache->start(new CacheKey('startnested', 'second', $i), null, false)) { echo $expected[$i++]; $cache->end(); } $cache->end(); } $cache->end(); } $data = $cache->end(false); } else { $this->assertTrue(false); } $this->assertEquals(implode('', $expected), $data); }
protected function _startcallback(CacheAbstract $cache) { $key = new CacheKey("startcallback", 1); $cache->clean($key); $this->assertFalse($cache->start($key)); echo "something "; $this->assertTrue($cache->appendCallback('callbackTesterStart')); echo " otherthing"; $output = $cache->end(false); $this->assertContains(CALLBACKVALUE, $output); // run again, we should have another value $second = $cache->start($key, null, false); $this->assertNotFalse($second); $this->assertContains(CALLBACKVALUE, $second); $this->assertNotEquals($second, $output); }
public function _dependencies(CacheAbstract $cache) { $cache->start('parent', 1); $cache->addDependency(); echo 'parent start/'; $this->assertFalse($cache->appendCallback('nawreanaweroi')); // invalid $cache->appendCallback('cacheCallback'); $cache->start('child', 2); echo '|child first|'; $cache->end(false); echo 'parent end/'; $cache->end(false); }