/** * @dataProvider assetsProvider */ public function testAssets($expectedResult, $externalStylesheets, $internalStylesheets = "", $externalJavascripts = "", $internalJavascripts = "") { $urlManager = $this->getMock('RedKiteLabs\\RedKiteCms\\RedKiteCmsBundle\\Core\\UrlManager\\UrlManagerInterface'); $theme = $this->getMockBuilder('RedKiteLabs\\ThemeEngineBundle\\Core\\Theme\\Theme')->disableOriginalConstructor()->getMock(); $themeSlots = $this->getMock('RedKiteLabs\\ThemeEngineBundle\\Core\\ThemeSlots\\ThemeSlotsInterface'); $theme->expects($this->once())->method('getThemeSlots')->will($this->returnValue($themeSlots)); $pageTree = $this->getMockBuilder('RedKiteLabs\\RedKiteCms\\RedKiteCmsBundle\\Core\\PageTree\\PageTree')->disableOriginalConstructor()->setMethods(array('getExternalStylesheets', 'getInternalStylesheets', 'getExternalJavascripts', 'getInternalJavascripts'))->getMock(); $pageTree->expects($this->once())->method('getExternalStylesheets')->will($this->returnValue($externalStylesheets)); $pageTree->expects($this->once())->method('getInternalStylesheets')->will($this->returnValue($internalStylesheets)); $pageTree->expects($this->once())->method('getExternalJavascripts')->will($this->returnValue($externalJavascripts)); $pageTree->expects($this->once())->method('getInternalJavascripts')->will($this->returnValue($internalJavascripts)); $metatagsSection = new AssetSection($urlManager); $options = array("uploadAssetsFullPath" => "", "uploadAssetsAbsolutePath" => "", "deployBundleAssetsPath" => ""); $this->assertEquals($expectedResult, $metatagsSection->generateSection($pageTree, $theme, $options)); }
/** * Generates the template's subsections and the full template itself */ protected function generatePageTemplate(PageTree $pageTree, ThemeInterface $theme, array $options) { if (!$this->page->getIsPublished()) { $this->twigTemplate = "{% extends 'RedKiteLabsThemeEngineBundle:Frontend:unpublished.html.twig' %}"; return $this; } $options["filter"] = array('page'); $this->twigTemplate = sprintf("{%% extends '%s:%s:%s/base/%s.html.twig' %%}" . PHP_EOL, $options["deployBundle"], $options["templatesDir"], $this->language->getLanguageName(), $this->page->getTemplateName()); $this->twigTemplate .= $this->metatagsSection->generateSection($pageTree, $theme, $options); $this->twigTemplate .= $this->assetsSection->generateSection($pageTree, $theme, $options); $this->twigTemplate .= $this->contentSection->generateSection($pageTree, $theme, $options); return $this; }