public function testAutoReloadOutdatedCacheHit() { $templateName = __FUNCTION__; $templateContent = __FUNCTION__; $cache = $this->createMock('Apishka_Templater_CacheInterface'); $loader = $this->getMockLoader($templateName, $templateContent); $twig = new Apishka_Templater_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false)); $now = time(); $cache->expects($this->once())->method('generateKey')->will($this->returnValue('key')); $cache->expects($this->once())->method('getTimestamp')->will($this->returnValue($now)); $loader->expects($this->once())->method('isFresh')->will($this->returnValue(false)); $cache->expects($this->never())->method('load'); $twig->loadTemplate($templateName); }