/** * {@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 testExistInParent($exists) { $this->_mockCurrentThemeService->shouldReceive('getCurrentTheme')->twice()->andReturn($this->_mockChildTheme); $this->_mockChildTheme->shouldReceive('hasTemplateSource')->twice()->with('template-name')->andReturn(false); $this->_mockChildTheme->shouldReceive('getParentThemeName')->twice()->andReturn('xyz'); $this->_mockChildTheme->shouldReceive('getName')->atLeast(1)->andReturn('abc'); $this->_mockChildTheme->shouldReceive('getVersion')->twice()->andReturn('1.2.3'); $this->_mockThemeRegistry->shouldReceive('getInstanceByName')->with('xyz')->andReturn($this->_mockParentTheme); $this->_mockParentTheme->shouldReceive('hasTemplateSource')->twice()->with('template-name')->andReturn($exists); $this->_mockChildTheme->shouldReceive('getVersion')->atLeast(1)->andReturn(tubepress_api_version_Version::parse('1.2.3')); if (!$exists) { $this->_mockParentTheme->shouldReceive('getParentThemeName')->twice()->andReturnNull(); $this->_mockParentTheme->shouldReceive('getName')->twice()->andReturn('parent-theme-name'); } else { $this->_mockParentTheme->shouldReceive('getName')->atLeast(1)->andReturn('xyz'); $this->_mockParentTheme->shouldReceive('getVersion')->atLeast(1)->andReturn('3.2.1'); } $this->assertTrue($this->_sut->exists('template-name') === $exists); $this->assertTrue($this->_sut->exists('template-name') === $exists); }
/** * {@inheritdoc} */ public function isFresh(\Symfony\Component\Templating\TemplateReferenceInterface $template, $time) { return $this->_themeTemplateLocator->isFresh($template->getLogicalName(), $time); }