/** * Renders a section on its own, i.e. without the a surrounding template. * * In this case, we just emulate that a surrounding (empty) layout exists, * and trigger the normal rendering flow then. * * @param string $sectionName Name of section to render * @param array $variables The variables to use * @param boolean $ignoreUnknown Ignore an unknown section and just return an empty string * @return string rendered template for the section */ protected function renderStandaloneSection($sectionName, array $variables = NULL, $ignoreUnknown = FALSE) { $templateIdentifier = $this->getTemplateIdentifier(); if ($this->templateCompiler->has($templateIdentifier)) { $parsedTemplate = $this->templateCompiler->get($templateIdentifier); } else { $this->templateParser->setConfiguration($this->buildParserConfiguration()); $parsedTemplate = $this->templateParser->parse($this->getTemplateSource()); if ($parsedTemplate->isCompilable()) { $this->templateCompiler->store($templateIdentifier, $parsedTemplate); } } $this->baseRenderingContext->setControllerContext($this->controllerContext); $this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext); $output = $this->renderSection($sectionName, $variables, $ignoreUnknown); $this->stopRendering(); return $output; }
/** * @test */ public function controllerContextCanBeReadCorrectly() { $controllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext', array(), array(), '', FALSE); $this->renderingContext->setControllerContext($controllerContext); $this->assertSame($this->renderingContext->getControllerContext(), $controllerContext); }
/** * @test */ public function controllerContextCanBeReadCorrectly() { $controllerContext = $this->getMock(\TYPO3\Flow\Mvc\Controller\ControllerContext::class, array(), array(), '', false); $this->renderingContext->setControllerContext($controllerContext); $this->assertSame($this->renderingContext->getControllerContext(), $controllerContext); }
/** * @test */ public function controllerContextCanBeReadCorrectly() { $controllerContext = $this->getMockBuilder(\TYPO3\Flow\Mvc\Controller\ControllerContext::class)->disableOriginalConstructor()->getMock(); $this->renderingContext->setControllerContext($controllerContext); $this->assertSame($this->renderingContext->getControllerContext(), $controllerContext); }