[TASK] Namespace classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Configuration / FrontendConfigurationManagerTest.php
index efa5eb6..380477e 100644 (file)
@@ -1,44 +1,45 @@
 <?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This class is a backport of the corresponding class of FLOW3.
-*  All credits go to the v5 team.
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
+namespace TYPO3\CMS\Extbase\Tests\Unit\Configuration;
 
-class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+ *  All rights reserved
+ *
+ *  This class is a backport of the corresponding class of FLOW3.
+ *  All credits go to the v5 team.
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+class FrontendConfigurationManagerTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
 
        /**
-        * @var tslib_fe
+        * @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
         */
        protected $tsfeBackup;
 
        /**
-        * @var tslib_cObj
+        * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
         */
        protected $mockContentObject;
 
        /**
-        * @var Tx_Extbase_Configuration_FrontendConfigurationManager
+        * @var \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager
         */
        protected $frontendConfigurationManager;
 
@@ -48,7 +49,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
        protected $extConfBackup;
 
        /**
-        * @var Tx_Extbase_Service_TypoScriptService
+        * @var \TYPO3\CMS\Extbase\Service\TypoScriptService
         */
        protected $mockTypoScriptService;
 
@@ -57,11 +58,11 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
         */
        public function setUp() {
                $this->tsfeBackup = $GLOBALS['TSFE'];
-               $this->mockContentObject = $this->getMock('tslib_cObj');
+               $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
                $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase'];
-               $this->frontendConfigurationManager = $this->getAccessibleMock('Tx_Extbase_Configuration_FrontendConfigurationManager', array('dummy'));
+               $this->frontendConfigurationManager = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array('dummy'));
                $this->frontendConfigurationManager->_set('contentObject', $this->mockContentObject);
-               $this->mockTypoScriptService = $this->getAccessibleMock('Tx_Extbase_Service_TypoScriptService');
+               $this->mockTypoScriptService = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
                $this->frontendConfigurationManager->injectTypoScriptService($this->mockTypoScriptService);
        }
 
@@ -76,7 +77,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
        /**
         * @test
         */
-       public function getTypoScriptSetupReturnsSetupFromTSFE() {
+       public function getTypoScriptSetupReturnsSetupFromTsfe() {
                $GLOBALS['TSFE']->tmpl->setup = array('foo' => 'bar');
                $this->assertEquals(array('foo' => 'bar'), $this->frontendConfigurationManager->_call('getTypoScriptSetup'));
        }
@@ -107,8 +108,8 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                );
                $testSetup = array(
                        'plugin.' => array(
-                               'tx_someextensionname.' => $testSettings,
-                       ),
+                               'tx_someextensionname.' => $testSettings
+                       )
                );
                $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
                $GLOBALS['TSFE']->tmpl->setup = $testSetup;
@@ -117,7 +118,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                                'foo' => 'bar'
                        )
                );
-               $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName', 'SomePluginName');
+               $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName');
                $this->assertEquals($expectedResult, $actualResult);
        }
 
@@ -138,7 +139,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                $testSetup = array(
                        'plugin.' => array(
                                'tx_someextensionname_somepluginname.' => $testSettings
-                       ),
+                       )
                );
                $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
                $GLOBALS['TSFE']->tmpl->setup = $testSetup;
@@ -160,7 +161,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                                'foo' => 'bar',
                                'some.' => array(
                                        'nested' => 'value'
-                               ),
+                               )
                        )
                );
                $testExtensionSettingsConverted = array(
@@ -168,30 +169,30 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                                'foo' => 'bar',
                                'some' => array(
                                        'nested' => 'value'
-                               ),
+                               )
                        )
                );
                $testPluginSettings = array(
                        'settings.' => array(
                                'some.' => array(
                                        'nested' => 'valueOverridde',
-                                       'new' => 'value',
-                               ),
+                                       'new' => 'value'
+                               )
                        )
                );
                $testPluginSettingsConverted = array(
                        'settings' => array(
                                'some' => array(
                                        'nested' => 'valueOverridde',
-                                       'new' => 'value',
-                               ),
+                                       'new' => 'value'
+                               )
                        )
                );
                $testSetup = array(
                        'plugin.' => array(
                                'tx_someextensionname.' => $testExtensionSettings,
-                               'tx_someextensionname_somepluginname.' => $testPluginSettings,
-                       ),
+                               'tx_someextensionname_somepluginname.' => $testPluginSettings
+                       )
                );
                $this->mockTypoScriptService->expects($this->at(0))->method('convertTypoScriptArrayToPlainArray')->with($testExtensionSettings)->will($this->returnValue($testExtensionSettingsConverted));
                $this->mockTypoScriptService->expects($this->at(1))->method('convertTypoScriptArrayToPlainArray')->with($testPluginSettings)->will($this->returnValue($testPluginSettingsConverted));
@@ -202,8 +203,8 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                                'some' => array(
                                        'nested' => 'valueOverridde',
                                        'new' => 'value'
-                               ),
-                       ),
+                               )
+                       )
                );
                $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName', 'SomePluginName');
                $this->assertEquals($expectedResult, $actualResult);
@@ -226,16 +227,18 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                $testSwitchableControllerActions = array(
                        'Controller1' => array(
                                'actions' => array(
-                                       'action1', 'action2'
+                                       'action1',
+                                       'action2'
                                ),
                                'nonCacheableActions' => array(
                                        'action1'
-                               ),
+                               )
                        ),
                        'Controller2' => array(
                                'actions' => array(
-                                       'action3', 'action4'
-                               ),
+                                       'action3',
+                                       'action4'
+                               )
                        )
                );
                $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['SomeExtensionName']['plugins']['SomePluginName']['controllers'] = $testSwitchableControllerActions;
@@ -280,7 +283,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                                        'actions' => array('action1 , action2')
                                ),
                                'Controller2' => array(
-                                       'actions' => array('action2', 'action1','action3'),
+                                       'actions' => array('action2', 'action1', 'action3'),
                                        'nonCacheableActions' => array('action2', 'action3')
                                )
                        )
@@ -293,11 +296,11 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                        'extensionName' => 'SomeExtension',
                        'controllerConfiguration' => array(
                                'Controller1' => array(
-                                       'actions' => array('action2'),
+                                       'actions' => array('action2')
                                ),
                                'Controller2' => array(
                                        'actions' => array('action3', 'action1'),
-                                       'nonCacheableActions' => array(1 => 'action3'),
+                                       'nonCacheableActions' => array(1 => 'action3')
                                )
                        )
                );
@@ -307,7 +310,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
 
        /**
         * @test
-        * @expectedException Tx_Extbase_Configuration_Exception_ParseError
+        * @expectedException \TYPO3\CMS\Extbase\Configuration\Exception\ParseError
         */
        public function overrideSwitchableControllerActionsThrowsExceptionIfFlexFormConfigurationIsInvalid() {
                $frameworkConfiguration = array(
@@ -318,7 +321,7 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                                        'actions' => array('action1 , action2')
                                ),
                                'Controller2' => array(
-                                       'actions' => array('action2', 'action1','action3'),
+                                       'actions' => array('action2', 'action1', 'action3'),
                                        'nonCacheableActions' => array('action2', 'action3')
                                )
                        )
@@ -336,9 +339,9 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                $frameworkConfiguration = array(
                        'some' => array(
                                'framework' => 'configuration'
-                       ),
+                       )
                );
-               $frontendConfigurationManager = $this->getAccessibleMock('Tx_Extbase_Configuration_FrontendConfigurationManager', array('overrideStoragePidIfStartingPointIsSet', 'overrideConfigurationFromPlugin', 'overrideConfigurationFromFlexForm'));
+               $frontendConfigurationManager = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array('overrideStoragePidIfStartingPointIsSet', 'overrideConfigurationFromPlugin', 'overrideConfigurationFromFlexForm'));
                $frontendConfigurationManager->expects($this->at(0))->method('overrideStoragePidIfStartingPointIsSet')->with($frameworkConfiguration)->will($this->returnValue(array('overridden' => 'storagePid')));
                $frontendConfigurationManager->expects($this->at(1))->method('overrideConfigurationFromPlugin')->with(array('overridden' => 'storagePid'))->will($this->returnValue(array('overridden' => 'pluginConfiguration')));
                $frontendConfigurationManager->expects($this->at(2))->method('overrideConfigurationFromFlexForm')->with(array('overridden' => 'pluginConfiguration'))->will($this->returnValue(array('overridden' => 'flexFormConfiguration')));
@@ -346,5 +349,8 @@ class Tx_Extbase_Tests_Unit_Configuration_FrontendConfigurationManagerTest exten
                $actualResult = $frontendConfigurationManager->_call('getContextSpecificFrameworkConfiguration', $frameworkConfiguration);
                $this->assertEquals($expectedResult, $actualResult);
        }
+
 }
+
+
 ?>
\ No newline at end of file