示例#1
0
 private function dependencies(CacheAbstract $cache)
 {
     $this->assertFalse($cache->appendCallback('cacheCallback'));
     // not in loop
     $cache->recursivestart('parent', 1);
     echo 'parent start/';
     $this->assertFalse($cache->appendCallback('nawreanaweroi'));
     // invalid
     $cache->appendCallback('cacheCallback');
     $cache->recursivestart('child', 2);
     echo '|child first|';
     $cache->recursiveend(false);
     echo 'parent end/';
     $cache->recursiveend(false);
     $data = $cache->get('child', 2);
     $cachedata = CacheData::unserialize($data);
     $this->assertEquals('|child first|', $cachedata->stringify($cache));
     $data = $cache->get('parent', 1);
     $cachedata = CacheData::unserialize($data);
     $this->assertEquals('parent start/aaaa|child first|parent end/', $cachedata->stringify($cache));
     $cache->delete('child', 2);
     $cache->recursivestart('child', 2);
     echo '|child second|';
     $cache->recursiveend(false);
     $data = $cache->get('child', 2);
     $cachedata = CacheData::unserialize($data);
     $this->assertEquals('|child second|', $cachedata->stringify($cache));
     $data = $cache->get('parent', 1);
     $cachedata = CacheData::unserialize($data);
     $this->assertEquals('parent start/bbbb|child second|parent end/', $cachedata->stringify($cache));
 }