+2010-10-29 Sebastian Kurfuerst <sebastian@typo3.org>
+
+ * Updated Fluid version to 1.3.0alpha3
+
2010-10-29 Christian Kuhn <lolli@schwarzbu.ch>
* Fixed bug #16140: [reports] PHP warning on missing array in reports system extension (Thanks to Rudi Meyer)
--- /dev/null
+<?php
+
+/* *
+ * This script belongs to the FLOW3 package "Fluid". *
+ * *
+ * It is free software; you can redistribute it and/or modify it under *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version. *
+ * *
+ * This script is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with the script. *
+ * If not, see http://www.gnu.org/licenses/lgpl.html *
+ * *
+ * The TYPO3 project - inspiring people to share! *
+ * */
+
+/**
+ * A standalone template view.
+ * Should be used as view if you want to use Fluid without Extbase extensions
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ * @api
+ */
+class Tx_Fluid_View_StandaloneView extends Tx_Fluid_View_AbstractTemplateView {
+
+ /**
+ * Source code of the Fluid template
+ * @var string
+ */
+ protected $templateSource = NULL;
+
+ /**
+ * absolute path of the Fluid template
+ * @var string
+ */
+ protected $templatePathAndFilename = NULL;
+
+ /**
+ * absolute root path of the folder that contains Fluid layouts
+ * @var string
+ */
+ protected $layoutRootPath = NULL;
+
+ /**
+ * absolute root path of the folder that contains Fluid partials
+ * @var string
+ */
+ protected $partialRootPath = NULL;
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ if (!t3lib_extMgm::isLoaded('extbase')) {
+ return 'In the current version you still need to have Extbase installed in order to use the Fluid Standalone view!';
+ }
+ $this->initializeAutoloader();
+ $this->injectTemplateParser(Tx_Fluid_Compatibility_TemplateParserBuilder::build());
+ $this->injectObjectManager(t3lib_div::makeInstance('Tx_Fluid_Compatibility_ObjectManager'));
+ $this->setRenderingContext($this->objectManager->create('Tx_Fluid_Core_Rendering_RenderingContext'));
+
+ $request = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Request');
+ $request->setRequestURI(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'));
+ $request->setBaseURI(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
+
+ $uriBuilder = t3lib_div::makeInstance('Tx_Extbase_MVC_Web_Routing_UriBuilder');
+ $uriBuilder->setRequest($request);
+
+ $controllerContext = $this->objectManager->create('Tx_Extbase_MVC_Controller_ControllerContext');
+ $controllerContext->setRequest($request);
+ $controllerContext->setUriBuilder($uriBuilder);
+ $flashMessageContainer = t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_FlashMessages'); // singleton
+ $controllerContext->setFlashMessageContainer($flashMessageContainer);
+ $this->setControllerContext($controllerContext);
+ }
+
+ /**
+ * Initializes the Extbase autoloader if it wasn't registered before
+ *
+ * @return void
+ * @see Extbase_Dispatcher::initializeClassLoader()
+ */
+ protected function initializeAutoloader() {
+ if (!class_exists('Tx_Extbase_Utility_ClassLoader', FALSE)) {
+ $classLoader = t3lib_div::makeInstance('Tx_Extbase_Utility_ClassLoader');
+ spl_autoload_register(array($classLoader, 'loadClass'));
+ }
+ }
+
+ /**
+ * Sets the format of the current request (default format is "html")
+ *
+ * @param string $format
+ * @return void
+ * @api
+ */
+ public function setFormat($format) {
+ $this->getRequest()->setFormat($format);
+ }
+
+ /**
+ * Returns the format of the current request (defaults is "html")
+ *
+ * @return string $format
+ * @api
+ */
+ public function getFormat() {
+ return $this->getRequest()->getFormat();
+ }
+
+ /**
+ * Returns the current request object
+ *
+ * @return Tx_Extbase_MVC_Web_Request
+ */
+ public function getRequest() {
+ return $this->controllerContext->getRequest();
+ }
+
+ /**
+ * Sets the absolute path to a Fluid template file
+ *
+ * @param string $templatePathAndFilename Fluid template path
+ * @return void
+ * @api
+ */
+ public function setTemplatePathAndFilename($templatePathAndFilename) {
+ $this->templatePathAndFilename = $templatePathAndFilename;
+ }
+
+ /**
+ * Returns the absolute path to a Fluid template file if it was specified with setTemplatePathAndFilename() before
+ *
+ * @return string Fluid template path
+ * @api
+ */
+ public function getTemplatePathAndFilename() {
+ return $this->templatePathAndFilename;
+ }
+
+ /**
+ * Sets the Fluid template source
+ * You can use setTemplatePathAndFilename() alternatively if you only want to specify the template path
+ *
+ * @param string $templateSource Fluid template source code
+ * @return void
+ * @api
+ */
+ public function setTemplateSource($templateSource) {
+ $this->templateSource = $templateSource;
+ }
+
+ /**
+ * Sets the absolute path to the folder that contains Fluid layout files
+ *
+ * @param string $layoutRootPath Fluid layout root path
+ * @return void
+ * @api
+ */
+ public function setLayoutRootPath($layoutRootPath) {
+ $this->layoutRootPath = $layoutRootPath;
+ }
+
+ /**
+ * Returns the absolute path to the folder that contains Fluid layout files
+ *
+ * @return string Fluid layout root path
+ * @api
+ */
+ public function getLayoutRootPath() {
+ if ($this->layoutRootPath === NULL && $this->templatePathAndFilename === NULL) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('No layout root path has been specified. Use setLayoutRootPath().', 1288091419);
+ }
+ if ($this->layoutRootPath === NULL) {
+ $this->layoutRootPath = dirname($this->templatePathAndFilename) . '/Layouts';
+ }
+ return $this->layoutRootPath;
+ }
+
+ /**
+ * Sets the absolute path to the folder that contains Fluid partial files.
+ *
+ * @param string $partialRootPath Fluid partial root path
+ * @return void
+ * @api
+ */
+ public function setPartialRootPath($partialRootPath) {
+ $this->partialRootPath = $partialRootPath;
+ }
+
+ /**
+ * Returns the absolute path to the folder that contains Fluid partial files
+ *
+ * @return string Fluid partial root path
+ * @api
+ */
+ public function getPartialRootPath() {
+ if ($this->partialRootPath === NULL && $this->templatePathAndFilename === NULL) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('No partial root path has been specified. Use setPartialRootPath().', 1288094511);
+ }
+ if ($this->partialRootPath === NULL) {
+ $this->partialRootPath = dirname($this->templatePathAndFilename) . '/Partials';
+ }
+ return $this->partialRootPath;
+ }
+
+ /**
+ * Checks whether a template can be resolved for the current request
+ *
+ * @return boolean
+ * @api
+ */
+ public function hasTemplate() {
+ try {
+ $this->getTemplateSource();
+ return TRUE;
+ } catch (Tx_Fluid_View_Exception_InvalidTemplateResourceException $e) {
+ return FALSE;
+ }
+ }
+
+ /**
+ * Returns the Fluid template source code
+ *
+ * @param string $actionName Name of the action. This argument is not used in this view!
+ * @return string Fluid template source
+ * @throws Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ */
+ protected function getTemplateSource($actionName = NULL) {
+ if ($this->templateSource === NULL && $this->templatePathAndFilename === NULL) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('No template has been specified. Use either setTemplateSource() or setTemplatePathAndFilename().', 1288085266);
+ }
+ if ($this->templateSource === NULL) {
+ if (!file_exists($this->templatePathAndFilename)) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('Template could not be found at "' . $this->templatePathAndFilename . '".', 1288087061);
+ }
+ $this->templateSource = file_get_contents($this->templatePathAndFilename);
+ }
+ return $this->templateSource;
+ }
+
+ /**
+ * Resolves the path and file name of the layout file, based on
+ * $this->getLayoutRootPath() and request format and returns the file contents
+ *
+ * @param string $layoutName Name of the layout to use. If none given, use "default"
+ * @return string contents of the layout file if it was found
+ * @throws Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ */
+ protected function getLayoutSource($layoutName = 'default') {
+ $layoutRootPath = $this->getLayoutRootPath();
+ if (!is_dir($layoutRootPath)) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('Layout root path "' . $layoutRootPath . '" does not exist.', 1288092521);
+ }
+ $possibleLayoutPaths = array();
+ $possibleLayoutPaths[] = t3lib_div::fixWindowsFilePath($layoutRootPath . '/' . $layoutName . '.' . $this->getRequest()->getFormat());
+ $possibleLayoutPaths[] = t3lib_div::fixWindowsFilePath($layoutRootPath . '/' . $layoutName);
+ $found = FALSE;
+ foreach($possibleLayoutPaths as $layoutPathAndFilename) {
+ if (file_exists($layoutPathAndFilename)) {
+ $found = TRUE;
+ break;
+ }
+ }
+ if ($found !== TRUE) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('Could not load layout file. Tried following paths: "' . implode('", "', $possibleLayoutPaths) . '".', 1288092555);
+ }
+ return file_get_contents($layoutPathAndFilename);
+ }
+
+ /**
+ * Resolves the path and file name of the partial file, based on
+ * $this->getPartialRootPath() and request format and returns the file contents
+ *
+ * @param string $partialName The name of the partial
+ * @return string contents of the layout file if it was found
+ * @throws Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ protected function getPartialSource($partialName) {
+ $partialRootPath = $this->getPartialRootPath();
+ if (!is_dir($partialRootPath)) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('Partial root path "' . $partialRootPath . '" does not exist.', 1288094648);
+ }
+ $possiblePartialPaths = array();
+ $possiblePartialPaths[] = t3lib_div::fixWindowsFilePath($partialRootPath . '/' . $partialName . '.' . $this->getRequest()->getFormat());
+ $possiblePartialPaths[] = t3lib_div::fixWindowsFilePath($partialRootPath . '/' . $partialName);
+ $found = FALSE;
+ foreach($possiblePartialPaths as $partialPathAndFilename) {
+ if (file_exists($partialPathAndFilename)) {
+ $found = TRUE;
+ break;
+ }
+ }
+ if ($found !== TRUE) {
+ throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('Could not load partial file. Tried following paths: "' . implode('", "', $possiblePartialPaths) . '".', 1288092555);
+ }
+ return file_get_contents($partialPathAndFilename);
+ }
+
+}
+
+?>
\ No newline at end of file
$this->typoScriptSetup = $typoScriptSetup;
} else {
$configurationManager = Tx_Extbase_Dispatcher::getConfigurationManager();
+ if ($configurationManager === NULL) {
+ $configurationManager = t3lib_div::makeInstance('Tx_Extbase_Configuration_FrontendConfigurationManager');
+ $configurationManager->setContentObject($this->contentObject);
+ }
$this->typoScriptSetup = $configurationManager->loadTypoScriptSetup();
}
}
*/
public function __construct($contentObject = NULL) {
$this->contentObject = $contentObject !== NULL ? $contentObject : t3lib_div::makeInstance('tslib_cObj');
+ parent::__construct();
}
/**
--- /dev/null
+default layout
\ No newline at end of file
--- /dev/null
+<xml>xml layout</xml>
\ No newline at end of file
--- /dev/null
+Standalone view {fixture}
\ No newline at end of file
--- /dev/null
+<?php
+
+/* *
+ * This script belongs to the FLOW3 package "Fluid". *
+ * *
+ * It is free software; you can redistribute it and/or modify it under *
+ * the terms of the GNU Lesser General Public License as published by the *
+ * Free Software Foundation, either version 3 of the License, or (at your *
+ * option) any later version. *
+ * *
+ * This script is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with the script. *
+ * If not, see http://www.gnu.org/licenses/lgpl.html *
+ * *
+ * The TYPO3 project - inspiring people to share! *
+ * */
+
+/**
+ * Testcase for the StandaloneView
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class Tx_Fluid_View_StandaloneViewTest extends Tx_Extbase_BaseTestCase {
+
+ /**
+ * @var Tx_Fluid_View_StandaloneView
+ */
+ protected $view;
+
+ /**
+ * @var Tx_Fluid_Core_Rendering_RenderingContextInterface
+ */
+ protected $mockRenderingContext;
+
+ /**
+ * @var Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer
+ */
+ protected $mockViewHelperVariableContainer;
+
+ /**
+ * @var Tx_Extbase_MVC_Controller_ControllerContext
+ */
+ protected $mockControllerContext;
+
+ /**
+ * @var Tx_Fluid_Core_Parser_TemplateParser
+ */
+ protected $mockTemplateParser;
+
+ /**
+ * @var Tx_Fluid_Compatibility_ObjectManager
+ */
+ protected $mockObjectManager;
+
+ /**
+ * @var Tx_Extbase_MVC_Request
+ */
+ protected $mockRequest;
+
+ /**
+ * @var Tx_Fluid_Core_Parser_ParsedTemplateInterface
+ */
+ protected $mockParsedTemplate;
+
+ /**
+ * Sets up this test case
+ *
+ * @return void
+ */
+ public function setUp() {
+ $this->view = $this->getAccessibleMock('Tx_Fluid_View_StandaloneView', array('dummy'), array(), '', FALSE);
+ $this->mockTemplateParser = $this->getMock('Tx_Fluid_Core_Parser_TemplateParser');
+ $this->mockParsedTemplate = $this->getMock('Tx_Fluid_Core_Parser_ParsedTemplateInterface');
+ $this->mockTemplateParser->expects($this->any())->method('parse')->will($this->returnValue($this->mockParsedTemplate));
+ $this->view->injectTemplateParser($this->mockTemplateParser);
+ $this->mockObjectManager = $this->getMock('Tx_Fluid_Compatibility_ObjectManager');
+ $this->view->injectObjectManager($this->mockObjectManager);
+ $this->mockRenderingContext = $this->getMock('Tx_Fluid_Core_Rendering_RenderingContextInterface');
+ $this->mockViewHelperVariableContainer = $this->getMock('Tx_Fluid_Core_ViewHelper_ViewHelperVariableContainer');
+ $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer));
+ $this->mockControllerContext = $this->getMock('Tx_Extbase_MVC_Controller_ControllerContext');
+ $this->mockRequest = $this->getMock('Tx_Extbase_MVC_Request');
+ $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest));
+ $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext));
+ $this->view->setRenderingContext($this->mockRenderingContext);
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function renderThrowsExceptionIfTemplateIsNotSpecified() {
+ $this->view->render();
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function renderPassesSpecifiedTemplateSourceToTemplateParser() {
+ $this->view->setTemplateSource('The Template Source');
+ $this->mockTemplateParser->expects($this->once())->method('parse')->with('The Template Source');
+ $this->view->render();
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function renderLoadsSpecifiedTemplateFileAndPassesSourceToTemplateParser() {
+ $templatePathAndFilename = dirname(__FILE__) . '/Fixtures/StandaloneViewFixture.html';
+ $expectedResult = file_get_contents($templatePathAndFilename);
+ $this->view->setTemplatePathAndFilename($templatePathAndFilename);
+ $this->mockTemplateParser->expects($this->once())->method('parse')->with($expectedResult);
+ $this->view->render();
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function renderThrowsExceptionIfSpecifiedTemplateFileDoesNotExist() {
+ $this->view->setTemplatePathAndFilename('NonExistingTemplatePath');
+ $this->view->render();
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function setFormatSetsRequestFormat() {
+ $this->mockRequest->expects($this->once())->method('setFormat')->with('xml');
+ $this->view->setFormat('xml');
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutRootPathThrowsExceptionIfLayoutRootPathAndTemplatePathAreNotSpecified() {
+ $this->view->getLayoutRootPath();
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutRootPathReturnsSpecifiedLayoutRootPathByDefault() {
+ $templatePathAndFilename = 'some/template/RootPath/SomeTemplate.html';
+ $layoutRootPath = 'some/layout/RootPath';
+ $this->view->setTemplatePathAndFilename($templatePathAndFilename);
+ $this->view->setLayoutRootPath($layoutRootPath);
+ $actualResult = $this->view->getLayoutRootPath();
+ $this->assertEquals($layoutRootPath, $actualResult);
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutRootPathReturnsDefaultPathIfNoLayoutRootPathIsSpecified() {
+ $templatePathAndFilename = 'some/template/RootPath/SomeTemplate.html';
+ $this->view->setTemplatePathAndFilename($templatePathAndFilename);
+ $expectedResult = 'some/template/RootPath/Layouts';
+ $actualResult = $this->view->getLayoutRootPath();
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutSourceThrowsExceptionIfLayoutRootPathDoesNotExist() {
+ $this->view->setLayoutRootPath('some/non/existing/Path');
+ $this->view->_call('getLayoutSource');
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutSourceThrowsExceptionIfLayoutFileDoesNotExist() {
+ $layoutRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setLayoutRootPath($layoutRootPath);
+ $this->view->_call('getLayoutSource', 'NonExistingLayout');
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutSourceReturnsContentOfLayoutFileForTheDefaultFormat() {
+ $layoutRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setLayoutRootPath($layoutRootPath);
+ $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('html'));
+ $expectedResult = file_get_contents($layoutRootPath . '/LayoutFixture.html');
+ $actualResult = $this->view->_call('getLayoutSource', 'LayoutFixture');
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getLayoutSourceReturnsContentOfLayoutFileForTheSpecifiedFormat() {
+ $layoutRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setLayoutRootPath($layoutRootPath);
+ $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('xml'));
+ $expectedResult = file_get_contents($layoutRootPath . '/LayoutFixture.xml');
+ $actualResult = $this->view->_call('getLayoutSource', 'LayoutFixture');
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ 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);
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialRootPathThrowsExceptionIfPartialRootPathAndTemplatePathAreNotSpecified() {
+ $this->view->getPartialRootPath();
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialRootPathReturnsSpecifiedPartialRootPathByDefault() {
+ $templatePathAndFilename = 'some/template/RootPath/SomeTemplate.html';
+ $partialRootPath = 'some/partial/RootPath';
+ $this->view->setTemplatePathAndFilename($templatePathAndFilename);
+ $this->view->setPartialRootPath($partialRootPath);
+ $actualResult = $this->view->getPartialRootPath();
+ $this->assertEquals($partialRootPath, $actualResult);
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialRootPathReturnsDefaultPathIfNoPartialRootPathIsSpecified() {
+ $templatePathAndFilename = 'some/template/RootPath/SomeTemplate.html';
+ $this->view->setTemplatePathAndFilename($templatePathAndFilename);
+ $expectedResult = 'some/template/RootPath/Partials';
+ $actualResult = $this->view->getPartialRootPath();
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialSourceThrowsExceptionIfPartialRootPathDoesNotExist() {
+ $this->view->setPartialRootPath('some/non/existing/Path');
+ $this->view->_call('getPartialSource');
+ }
+
+ /**
+ * @test
+ * @expectedException Tx_Fluid_View_Exception_InvalidTemplateResourceException
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialSourceThrowsExceptionIfPartialFileDoesNotExist() {
+ $partialRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setPartialRootPath($partialRootPath);
+ $this->view->_call('getPartialSource', 'NonExistingPartial');
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialSourceReturnsContentOfPartialFileForTheDefaultFormat() {
+ $partialRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setPartialRootPath($partialRootPath);
+ $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('html'));
+ $expectedResult = file_get_contents($partialRootPath . '/LayoutFixture.html');
+ $actualResult = $this->view->_call('getPartialSource', 'LayoutFixture');
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialSourceReturnsContentOfPartialFileForTheSpecifiedFormat() {
+ $partialRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setPartialRootPath($partialRootPath);
+ $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('xml'));
+ $expectedResult = file_get_contents($partialRootPath . '/LayoutFixture.xml');
+ $actualResult = $this->view->_call('getPartialSource', 'LayoutFixture');
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+
+ /**
+ * @test
+ * @author Bastian Waidelich <bastian@typo3.org>
+ */
+ public function getPartialSourceReturnsContentOfDefaultPartialFileIfNoPartialExistsForTheSpecifiedFormat() {
+ $partialRootPath = dirname(__FILE__) . '/Fixtures';
+ $this->view->setPartialRootPath($partialRootPath);
+ $this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('foo'));
+ $expectedResult = file_get_contents($partialRootPath . '/LayoutFixture');
+ $actualResult = $this->view->_call('getPartialSource', 'LayoutFixture');
+ $this->assertEquals($expectedResult, $actualResult);
+ }
+}
+?>
\ No newline at end of file
<?php
// DO NOT CHANGE THIS FILE! It is automatically generated by Tx_Extbase_Utility_Extension::createAutoloadRegistryForExtension.
-// This file was generated on 2010-07-13 14:15
+// This file was generated on 2010-10-26 16:02
$extensionClassesPath = t3lib_extMgm::extPath('fluid') . 'Classes/';
return array(
'tx_fluid_service_docbookgenerator' => $extensionClassesPath . 'Service/DocbookGenerator.php',
'tx_fluid_view_abstracttemplateview' => $extensionClassesPath . 'View/AbstractTemplateView.php',
'tx_fluid_view_exception' => $extensionClassesPath . 'View/Exception.php',
+ 'tx_fluid_view_standaloneview' => $extensionClassesPath . 'View/StandaloneView.php',
'tx_fluid_view_templateview' => $extensionClassesPath . 'View/TemplateView.php',
'tx_fluid_view_templateviewinterface' => $extensionClassesPath . 'View/TemplateViewInterface.php',
'tx_fluid_view_exception_invalidsectionexception' => $extensionClassesPath . 'View/Exception/InvalidSectionException.php',
'tx_fluid_viewhelpers_be_buttons_shortcutviewhelper' => $extensionClassesPath . 'ViewHelpers/Be/Buttons/ShortcutViewHelper.php',
'tx_fluid_viewhelpers_be_menus_actionmenuitemviewhelper' => $extensionClassesPath . 'ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php',
'tx_fluid_viewhelpers_be_menus_actionmenuviewhelper' => $extensionClassesPath . 'ViewHelpers/Be/Menus/ActionMenuViewHelper.php',
+ 'tx_fluid_viewhelpers_be_security_ifauthenticatedviewhelper' => $extensionClassesPath . 'ViewHelpers/Be/Security/IfAuthenticatedViewHelper.php',
+ 'tx_fluid_viewhelpers_be_security_ifhasroleviewhelper' => $extensionClassesPath . 'ViewHelpers/Be/Security/IfHasRoleViewHelper.php',
'tx_fluid_viewhelpers_form_abstractformfieldviewhelper' => $extensionClassesPath . 'ViewHelpers/Form/AbstractFormFieldViewHelper.php',
'tx_fluid_viewhelpers_form_abstractformviewhelper' => $extensionClassesPath . 'ViewHelpers/Form/AbstractFormViewHelper.php',
'tx_fluid_viewhelpers_form_checkboxviewhelper' => $extensionClassesPath . 'ViewHelpers/Form/CheckboxViewHelper.php',
'tx_fluid_viewhelpers_link_emailviewhelper' => $extensionClassesPath . 'ViewHelpers/Link/EmailViewHelper.php',
'tx_fluid_viewhelpers_link_externalviewhelper' => $extensionClassesPath . 'ViewHelpers/Link/ExternalViewHelper.php',
'tx_fluid_viewhelpers_link_pageviewhelper' => $extensionClassesPath . 'ViewHelpers/Link/PageViewHelper.php',
+ 'tx_fluid_viewhelpers_security_ifauthenticatedviewhelper' => $extensionClassesPath . 'ViewHelpers/Security/IfAuthenticatedViewHelper.php',
+ 'tx_fluid_viewhelpers_security_ifhasroleviewhelper' => $extensionClassesPath . 'ViewHelpers/Security/IfHasRoleViewHelper.php',
'tx_fluid_viewhelpers_uri_actionviewhelper' => $extensionClassesPath . 'ViewHelpers/Uri/ActionViewHelper.php',
'tx_fluid_viewhelpers_uri_emailviewhelper' => $extensionClassesPath . 'ViewHelpers/Uri/EmailViewHelper.php',
'tx_fluid_viewhelpers_uri_externalviewhelper' => $extensionClassesPath . 'ViewHelpers/Uri/ExternalViewHelper.php',
'clearCacheOnLoad' => 0,
'lockType' => '',
'author_company' => '',
- 'version' => '1.3.0alpha2',
+ 'version' => '1.3.0alpha3',
'constraints' => array(
'depends' => array(
'extbase' => '1.3.0alpha2',
-https://svn.typo3.org/TYPO3v4/CoreProjects/MVC/fluid/tags/1.3.0alpha2/
+https://svn.typo3.org/TYPO3v4/CoreProjects/MVC/fluid/tags/1.3.0alpha3/