/** * @dataProvider contentsProvider */ public function testGenerateContents($filter, $slots, $blocks, $credits, $expectedResult) { $urlManager = $this->getMock('RedKiteLabs\\RedKiteCms\\RedKiteCmsBundle\\Core\\UrlManager\\UrlManagerInterface'); $viewRenderer = $this->getMock('RedKiteLabs\\RedKiteCms\\RedKiteCmsBundle\\Core\\ViewRenderer\\ViewRendererInterface'); $theme = $this->initTheme($slots, $filter); $pageBlocks = $this->initPageBlocks($blocks); $pageTree = $this->initPageTree($pageBlocks); $blocksManagerFactory = $this->initBlocksFactory($pageTree, $blocks, $viewRenderer); $contentSection = new ContentSection($urlManager, $viewRenderer, $blocksManagerFactory); $options = array("uploadAssetsFullPath" => "", "uploadAssetsAbsolutePath" => "", "deployBundleAssetsPath" => "", "filter" => $filter, "credits" => $credits); $this->assertEquals($expectedResult, $contentSection->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; }