public function testLoad() { $storage = new FileStorage('data'); $this->assertTrue(is_dir(TEST_BASE_DIR . '/data')); $collector = new CacheDataCollector(); $data = array('My tested data'); $collector->setData($data); $storage->save($collector); $collector->setData(array()); $storage->load($collector); $this->assertEquals($data, $collector->getData()); }
public function testStats() { $collector = new CacheDataCollector(); $this->assertEquals(array(), $collector->getStatsForKey(null)); $key = $collector->getRequest()->getPathInfo(); $collector->setData(array($key => array('test'))); $this->assertArrayHasKey($key, $collector->getStats()); $this->assertNotEmpty($collector->getStatsForKey($key)); }