[+TASK] Extbase (Tests): Renamed test files from "*_testcase.php" to "*Test.php"
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Configuration / FrontendConfigurationManagerTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of FLOW3.
9 * All credits go to the v5 team.
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 class Tx_Extbase_Configuration_FrontendConfigurationManager_testcase extends Tx_Extbase_Tests_Unit_BaseTestCase {
29
30 /**
31 * @var tslib_fe
32 */
33 protected $tsfeBackup;
34
35 /**
36 * @var Tx_Extbase_Configuration_FrontendConfigurationManager
37 */
38 protected $frontendConfigurationManager;
39 /**
40 * Sets up this testcase
41 */
42 public function setUp() {
43 $this->tsfeBackup = $GLOBALS['TSFE'];
44 $this->frontendConfigurationManager = $this->getMock($this->buildAccessibleProxy('Tx_Extbase_Configuration_FrontendConfigurationManager'), array('dummy'));
45 }
46
47 /**
48 * Tears down this testcase
49 */
50 public function tearDown() {
51 $GLOBALS['TSFE']->tmpl->setup;
52 }
53
54 /**
55 * @test
56 */
57 public function getTypoScriptSetupReturnsSetupFromTSFE() {
58 $GLOBALS['TSFE']->tmpl->setup = array('foo' => 'bar');
59 $this->assertEquals(array('foo' => 'bar'), $this->frontendConfigurationManager->_callRef('getTypoScriptSetup'));
60 }
61
62 /**
63 * @test
64 */
65 public function overrideSwitchableControllerActionsFromFlexformMergesNonCacheableActions() {
66 $frameworkConfiguration = array(
67 'userFunc' => 'tx_extbase_dispatcher->dispatch',
68 'pluginName' => 'Pi1',
69 'extensionName' => 'SomeExtension',
70 'switchableControllerActions' => array(
71 'Controller1' => array(
72 'controller' => 'Controller1',
73 'actions' => 'action1 , action2'
74 ),
75 'Controller2' => array(
76 'controller' => 'Controller2',
77 'actions' => 'action2 , action1,action3',
78 'nonCacheableActions' => 'action2, action3'
79 )
80 )
81 );
82 $flexformConfiguration = array(
83 'switchableControllerActions' => 'Controller1->action2;Controller2->action3;Controller2->action1'
84 );
85 $expectedResult = array(
86 'userFunc' => 'tx_extbase_dispatcher->dispatch',
87 'pluginName' => 'Pi1',
88 'extensionName' => 'SomeExtension',
89 'switchableControllerActions' => array(
90 'Controller1' => array(
91 'controller' => 'Controller1',
92 'actions' => 'action2'
93 ),
94 'Controller2' => array(
95 'controller' => 'Controller2',
96 'actions' => 'action3,action1',
97 'nonCacheableActions' => 'action3'
98 )
99 )
100 );
101 $actualResult = $this->frontendConfigurationManager->_callRef('overrideSwitchableControllerActionsFromFlexform', $frameworkConfiguration, $flexformConfiguration);
102 $this->assertEquals($expectedResult, $actualResult);
103 }
104 }
105 ?>