Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getCacheKey($name)
 {
     if (!$this->_themeTemplateLocator->exists($name)) {
         throw $this->_loaderError($name);
     }
     return $this->_themeTemplateLocator->getCacheKey($name);
 }
 /**
  * @dataProvider trueAndFalse
  */
 public function testCacheKey($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('getTemplateCacheKey')->once()->andReturn($fresh);
         $expected = $fresh;
     } else {
         $this->_mockChildTheme->shouldReceive('getParentThemeName')->once()->andReturnNull();
         $this->setExpectedException('InvalidArgumentException');
     }
     $actual = $this->_sut->getCacheKey('template-name');
     $this->assertEquals($expected, $actual);
 }