/** * {@inheritdoc} */ public function isFresh($name, $time) { if (!$this->_themeTemplateLocator->exists($name)) { throw $this->_loaderError($name); } return $this->_themeTemplateLocator->isFresh($name, $time); }
/** * @dataProvider trueAndFalse */ public function testIsFresh($fresh) { $this->_mockCurrentThemeService->shouldReceive('getCurrentTheme')->once()->andReturn($this->_mockChildTheme); $this->_mockChildTheme->shouldReceive('hasTemplateSource')->once()->with('template-name')->andReturn($fresh); $this->_mockChildTheme->shouldReceive('getName')->atLeast(1)->andReturn('abc'); $this->_mockChildTheme->shouldReceive('getVersion')->atLeast(1)->andReturn(tubepress_api_version_Version::parse('1.2.3')); if ($fresh) { $this->_mockChildTheme->shouldReceive('isTemplateSourceFresh')->once()->andReturn($fresh); $expected = $fresh; } else { $this->_mockChildTheme->shouldReceive('getParentThemeName')->once()->andReturnNull(); $this->setExpectedException('InvalidArgumentException'); } $actual = $this->_sut->isFresh('template-name', PHP_INT_MAX); $this->assertEquals($expected, $actual); }
/** * {@inheritdoc} */ public function isFresh(\Symfony\Component\Templating\TemplateReferenceInterface $template, $time) { return $this->_themeTemplateLocator->isFresh($template->getLogicalName(), $time); }