/** * {@inheritdoc} */ public function getSource($name) { if (!$this->_themeTemplateLocator->exists($name)) { throw $this->_loaderError($name); } return $this->_themeTemplateLocator->getSource($name); }
/** * @dataProvider trueAndFalse */ public function testGetTemplateSource($exists) { $this->_mockCurrentThemeService->shouldReceive('getCurrentTheme')->once()->andReturn($this->_mockChildTheme); $this->_mockChildTheme->shouldReceive('hasTemplateSource')->once()->with('template-name')->andReturn($exists); $this->_mockChildTheme->shouldReceive('getName')->atLeast(1)->andReturn('abc'); $this->_mockChildTheme->shouldReceive('getVersion')->atLeast(1)->andReturn(tubepress_api_version_Version::parse('1.2.3')); if ($exists) { $this->_mockChildTheme->shouldReceive('getTemplateSource')->once()->andReturn('foobar'); $expected = 'foobar'; } else { $this->_mockChildTheme->shouldReceive('getParentThemeName')->once()->andReturnNull(); $expected = null; } $actual = $this->_sut->getSource('template-name'); $this->assertEquals($expected, $actual); }