コード例 #1
0
 public function testExistingFileReturnsStatisticsObject()
 {
     $file = vfsStream::newFile($this->filename);
     $this->root->addChild($file);
     $manager = new FilecacheStatisticsManager(vfsStream::url($this->path));
     $result = $manager->getStatistics();
     $this->assertInstanceOf('\\Beryllium\\Cache\\Statistics\\Statistics', $result['File cache']);
 }
コード例 #2
0
 public function testStats()
 {
     $stats = new FilecacheStatisticsTracker(vfsStream::url('cacheDir'));
     $manager = new FilecacheStatisticsManager(vfsStream::url('cacheDir'));
     $this->cache->setStatisticsTracker($stats);
     $this->cache->get('test');
     $this->cache->set('test', 'testing', 300);
     $this->cache->get('test');
     $data = $manager->getStatistics();
     $this->assertEquals(array('File cache'), array_keys($data));
     $numbers = $data['File cache']->getFormattedArray();
     $this->assertEquals(array('Hits' => 1, 'Misses' => 1, 'Helpfulness' => '50.00'), $numbers);
 }