/** * @test * @expectedException \TYPO3\Fluid\View\Exception\InvalidTemplateResourceException */ public function getLayoutPathAndFilenameThrowsExceptionIfLayoutFileIsADirectory() { vfsStreamWrapper::register(); mkdir('vfs://MyLayouts/NotAFile'); $this->standaloneView->setLayoutRootPath('vfs://MyLayouts'); $this->standaloneView->_call('getLayoutPathAndFilename', 'NotAFile'); }
/** * @test */ public function getLayoutSourceReturnsContentOfDefaultLayoutFileIfNoLayoutExistsForTheSpecifiedFormat() { $layoutRootPath = dirname(__FILE__) . '/Fixtures'; $this->view->setLayoutRootPath($layoutRootPath); $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('foo')); $expectedResult = file_get_contents($layoutRootPath . '/LayoutFixture'); $actualResult = $this->view->_call('getLayoutSource', 'LayoutFixture'); $this->assertEquals($expectedResult, $actualResult); }
/** * Prepare a Fluid view for rendering an error page with the Neos backend * * @return StandaloneView */ protected function prepareFluidView() { $fluidView = new StandaloneView(); $fluidView->setTemplatePathAndFilename('resource://TYPO3.Neos/Private/Templates/Error/NeosBackendMessage.html'); $fluidView->setLayoutRootPath('resource://TYPO3.Neos/Private/Layouts'); // FIXME find a better way than using templates as partials $fluidView->setPartialRootPath('resource://TYPO3.Neos/Private/Templates/TypoScriptObjects'); $fluidView->setControllerContext($this->runtime->getControllerContext()); $fluidView->setFormat('html'); return $fluidView; }
/** * @param \TYPO3\Fluid\View\StandaloneView $view * @return void */ protected function addTemplateViewPaths(StandaloneView &$view) { $translatedPaths = $this->environment->getTranslatedTemplatePaths(); $view->setPartialRootPath($translatedPaths['partialRootPath']); $view->setLayoutRootPath($translatedPaths['layoutRootPath']); }
/** * Prepares a Fluid view for rendering the custom error page. * * @param \Exception $exception * @param array $renderingOptions Rendering options as defined in the settings * @return StandaloneView */ protected function buildCustomFluidView(\Exception $exception, array $renderingOptions) { $statusCode = 500; $referenceCode = NULL; if ($exception instanceof FlowException) { $statusCode = $exception->getStatusCode(); $referenceCode = $exception->getReferenceCode(); } $statusMessage = Response::getStatusMessageByCode($statusCode); $fluidView = new StandaloneView(); $fluidView->getRequest()->setControllerPackageKey('TYPO3.Flow'); $fluidView->setTemplatePathAndFilename($renderingOptions['templatePathAndFilename']); if (isset($renderingOptions['layoutRootPath'])) { $fluidView->setLayoutRootPath($renderingOptions['layoutRootPath']); } if (isset($renderingOptions['partialRootPath'])) { $fluidView->setPartialRootPath($renderingOptions['partialRootPath']); } if (isset($renderingOptions['format'])) { $fluidView->setFormat($renderingOptions['format']); } if (isset($renderingOptions['variables'])) { $fluidView->assignMultiple($renderingOptions['variables']); } $fluidView->assignMultiple(array('exception' => $exception, 'renderingOptions' => $renderingOptions, 'statusCode' => $statusCode, 'statusMessage' => $statusMessage, 'referenceCode' => $referenceCode)); return $fluidView; }