[TASK] Use name-resolution instead of strings where possible: 3
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Configuration / AbstractConfigurationManagerTest.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Configuration;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Test case
19 */
20 class AbstractConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
24 */
25 protected $abstractConfigurationManager;
26
27 /**
28 * @var \TYPO3\CMS\Extbase\Service\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
29 */
30 protected $mockTypoScriptService;
31
32 /**
33 * @var array
34 */
35 protected $testTypoScriptSetup = array(
36 'foo.' => array(
37 'bar' => 'baz'
38 ),
39 'config.' => array(
40 'tx_extbase.' => array(
41 'settings.' => array(
42 'setting1' => 'value1',
43 'setting2' => 'value2'
44 ),
45 'view.' => array(
46 'viewSub.' => array(
47 'key1' => 'value1',
48 'key2' => 'value2'
49 )
50 )
51 )
52 )
53 );
54
55 /**
56 * @var array
57 */
58 protected $testTypoScriptSetupConverted = array(
59 'foo' => array(
60 'bar' => 'baz'
61 ),
62 'config' => array(
63 'tx_extbase' => array(
64 'settings' => array(
65 'setting1' => 'value1',
66 'setting2' => 'value2'
67 ),
68 'view' => array(
69 'viewSub' => array(
70 'key1' => 'value1',
71 'key2' => 'value2'
72 )
73 )
74 )
75 )
76 );
77
78 /**
79 * @var array
80 */
81 protected $testPluginConfiguration = array(
82 'settings' => array(
83 'setting1' => 'overriddenValue1',
84 'setting3' => 'additionalValue'
85 ),
86 'view' => array(
87 'viewSub' => array(
88 'key1' => 'overridden',
89 'key3' => 'new key'
90 )
91 ),
92 'persistence' => array(
93 'storagePid' => '123'
94 )
95 );
96
97 /**
98 * @var array
99 */
100 protected $testSwitchableControllerActions = array(
101 'Controller1' => array(
102 'actions' => array('action1', 'action2', 'action3')
103 ),
104 'Controller2' => array(
105 'actions' => array('action4', 'action5', 'action6'),
106 'nonCacheableActions' => array('action4', 'action6')
107 )
108 );
109
110 /**
111 * Sets up this testcase
112 */
113 public function setUp() {
114 $this->abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager::class, array('getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions', 'getRecursiveStoragePids'));
115 $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
116 $this->abstractConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
117 }
118
119 /**
120 * @test
121 */
122 public function setConfigurationResetsConfigurationCache() {
123 $this->abstractConfigurationManager->_set('configurationCache', array('foo' => 'bar'));
124 $this->abstractConfigurationManager->setConfiguration(array());
125 $this->assertEquals(array(), $this->abstractConfigurationManager->_get('configurationCache'));
126 }
127
128 /**
129 * @test
130 */
131 public function setConfigurationSetsExtensionAndPluginName() {
132 $configuration = array(
133 'extensionName' => 'SomeExtensionName',
134 'pluginName' => 'SomePluginName'
135 );
136 $this->abstractConfigurationManager->setConfiguration($configuration);
137 $this->assertEquals('SomeExtensionName', $this->abstractConfigurationManager->_get('extensionName'));
138 $this->assertEquals('SomePluginName', $this->abstractConfigurationManager->_get('pluginName'));
139 }
140
141 /**
142 * @test
143 */
144 public function setConfigurationConvertsTypoScriptArrayToPlainArray() {
145 $configuration = array(
146 'foo' => 'bar',
147 'settings.' => array('foo' => 'bar'),
148 'view.' => array('subkey.' => array('subsubkey' => 'subsubvalue'))
149 );
150 $expectedResult = array(
151 'foo' => 'bar',
152 'settings' => array('foo' => 'bar'),
153 'view' => array('subkey' => array('subsubkey' => 'subsubvalue'))
154 );
155 $this->mockTypoScriptService->expects($this->atLeastOnce())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($expectedResult));
156 $this->abstractConfigurationManager->setConfiguration($configuration);
157 $this->assertEquals($expectedResult, $this->abstractConfigurationManager->_get('configuration'));
158 }
159
160 /**
161 * @test
162 */
163 public function getConfigurationReturnsCachedResultOfCurrentPlugin() {
164 $this->abstractConfigurationManager->_set('extensionName', 'CurrentExtensionName');
165 $this->abstractConfigurationManager->_set('pluginName', 'CurrentPluginName');
166 $this->abstractConfigurationManager->_set('configurationCache', array('currentextensionname_currentpluginname' => array('foo' => 'bar'), 'someotherextension_somepluginname' => array('baz' => 'shouldnotbereturned')));
167 $expectedResult = array('foo' => 'bar');
168 $actualResult = $this->abstractConfigurationManager->getConfiguration();
169 $this->assertEquals($expectedResult, $actualResult);
170 }
171
172 /**
173 * @test
174 */
175 public function getConfigurationReturnsCachedResultForGivenExtension() {
176 $this->abstractConfigurationManager->_set('configurationCache', array('someextensionname_somepluginname' => array('foo' => 'bar'), 'someotherextension_somepluginname' => array('baz' => 'shouldnotbereturned')));
177 $expectedResult = array('foo' => 'bar');
178 $actualResult = $this->abstractConfigurationManager->getConfiguration('SomeExtensionName', 'SomePluginName');
179 $this->assertEquals($expectedResult, $actualResult);
180 }
181
182 /**
183 * @test
184 */
185 public function getConfigurationRecursivelyMergesCurrentPluginConfigurationWithFrameworkConfiguration() {
186 $this->abstractConfigurationManager->_set('extensionName', 'CurrentExtensionName');
187 $this->abstractConfigurationManager->_set('pluginName', 'CurrentPluginName');
188 $this->abstractConfigurationManager->expects($this->once())->method('getTypoScriptSetup')->will($this->returnValue($this->testTypoScriptSetup));
189 $this->mockTypoScriptService->expects($this->atLeastOnce())->method('convertTypoScriptArrayToPlainArray')->with($this->testTypoScriptSetup['config.']['tx_extbase.'])->will($this->returnValue($this->testTypoScriptSetupConverted['config']['tx_extbase']));
190 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
191 $expectedResult = array(
192 'settings' => array(
193 'setting1' => 'overriddenValue1',
194 'setting2' => 'value2',
195 'setting3' => 'additionalValue'
196 ),
197 'view' => array(
198 'viewSub' => array(
199 'key1' => 'overridden',
200 'key2' => 'value2',
201 'key3' => 'new key'
202 )
203 ),
204 'persistence' => array(
205 'storagePid' => '123'
206 ),
207 'controllerConfiguration' => NULL
208 );
209 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->with($expectedResult)->will($this->returnValue($expectedResult));
210 $actualResult = $this->abstractConfigurationManager->getConfiguration();
211 $this->assertEquals($expectedResult, $actualResult);
212 }
213
214 /**
215 * @test
216 */
217 public function getConfigurationRecursivelyMergesPluginConfigurationOfSpecifiedPluginWithFrameworkConfiguration() {
218 $this->abstractConfigurationManager->expects($this->once())->method('getTypoScriptSetup')->will($this->returnValue($this->testTypoScriptSetup));
219 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('SomeExtensionName', 'SomePluginName')->will($this->returnValue($this->testPluginConfiguration));
220 $this->mockTypoScriptService->expects($this->atLeastOnce())->method('convertTypoScriptArrayToPlainArray')->with($this->testTypoScriptSetup['config.']['tx_extbase.'])->will($this->returnValue($this->testTypoScriptSetupConverted['config']['tx_extbase']));
221 $expectedResult = array(
222 'settings' => array(
223 'setting1' => 'overriddenValue1',
224 'setting2' => 'value2',
225 'setting3' => 'additionalValue'
226 ),
227 'view' => array(
228 'viewSub' => array(
229 'key1' => 'overridden',
230 'key2' => 'value2',
231 'key3' => 'new key'
232 )
233 ),
234 'persistence' => array(
235 'storagePid' => '123'
236 ),
237 'controllerConfiguration' => NULL
238 );
239 $this->abstractConfigurationManager->expects($this->never())->method('getContextSpecificFrameworkConfiguration');
240 $actualResult = $this->abstractConfigurationManager->getConfiguration('SomeExtensionName', 'SomePluginName');
241 $this->assertEquals($expectedResult, $actualResult);
242 }
243
244 /**
245 * @test
246 */
247 public function getConfigurationDoesNotOverrideConfigurationWithContextSpecificFrameworkConfigurationIfDifferentPluginIsSpecified() {
248 $this->abstractConfigurationManager->expects($this->never())->method('getContextSpecificFrameworkConfiguration');
249 $this->abstractConfigurationManager->getConfiguration('SomeExtensionName', 'SomePluginName');
250 }
251
252 /**
253 * @test
254 */
255 public function getConfigurationOverridesConfigurationWithContextSpecificFrameworkConfigurationIfNoPluginWasSpecified() {
256 $this->abstractConfigurationManager->expects($this->once())->method('getTypoScriptSetup')->will($this->returnValue($this->testTypoScriptSetup));
257 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with()->will($this->returnValue($this->testPluginConfiguration));
258 $contextSpecifixFrameworkConfiguration = array(
259 'context' => array(
260 'specific' => 'framwork',
261 'conf' => 'iguration'
262 )
263 );
264 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnValue($contextSpecifixFrameworkConfiguration));
265 $actualResult = $this->abstractConfigurationManager->getConfiguration();
266 $this->assertEquals($contextSpecifixFrameworkConfiguration, $actualResult);
267 }
268
269 /**
270 * @test
271 */
272 public function getConfigurationOverridesConfigurationWithContextSpecificFrameworkConfigurationIfSpecifiedPluginIsTheCurrentPlugin() {
273 $this->abstractConfigurationManager->_set('extensionName', 'CurrentExtensionName');
274 $this->abstractConfigurationManager->_set('pluginName', 'CurrentPluginName');
275 $this->abstractConfigurationManager->expects($this->once())->method('getTypoScriptSetup')->will($this->returnValue($this->testTypoScriptSetup));
276 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
277 $contextSpecifixFrameworkConfiguration = array(
278 'context' => array(
279 'specific' => 'framwork',
280 'conf' => 'iguration'
281 )
282 );
283 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnValue($contextSpecifixFrameworkConfiguration));
284 $actualResult = $this->abstractConfigurationManager->getConfiguration('CurrentExtensionName', 'CurrentPluginName');
285 $this->assertEquals($contextSpecifixFrameworkConfiguration, $actualResult);
286 }
287
288 /**
289 * @test
290 */
291 public function getConfigurationStoresResultInConfigurationCache() {
292 $this->abstractConfigurationManager->_set('extensionName', 'CurrentExtensionName');
293 $this->abstractConfigurationManager->_set('pluginName', 'CurrentPluginName');
294 $this->abstractConfigurationManager->expects($this->any())->method('getPluginConfiguration')->will($this->returnValue(array('foo' => 'bar')));
295 $this->abstractConfigurationManager->getConfiguration();
296 $this->abstractConfigurationManager->getConfiguration('SomeOtherExtensionName', 'SomeOtherCurrentPluginName');
297 $expectedResult = array('currentextensionname_currentpluginname', 'someotherextensionname_someothercurrentpluginname');
298 $actualResult = array_keys($this->abstractConfigurationManager->_get('configurationCache'));
299 $this->assertEquals($expectedResult, $actualResult);
300 }
301
302 /**
303 * @test
304 */
305 public function getConfigurationRetrievesStoragePidIncludingGivenStoragePidWithRecursiveSetForSingleStoragePid() {
306 $pluginConfiguration = array(
307 'persistence' => array(
308 'storagePid' => 1,
309 'recursive' => 99
310 )
311 );
312 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->will($this->returnValue($pluginConfiguration));
313 $this->abstractConfigurationManager->expects($this->once())->method('getRecursiveStoragePids')->with('-1');
314 $this->abstractConfigurationManager->getConfiguration('SomeOtherExtensionName', 'SomeOtherCurrentPluginName');
315 }
316
317 /**
318 * @test
319 */
320 public function getConfigurationRetrievesStoragePidIncludingGivenStoragePidWithRecursiveSetForMultipleStoragePid() {
321 $pluginConfiguration = array(
322 'persistence' => array(
323 'storagePid' => '1,25',
324 'recursive' => 99
325 )
326 );
327 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->will($this->returnValue($pluginConfiguration));
328 $this->abstractConfigurationManager->expects($this->once())->method('getRecursiveStoragePids')->with('-1,-25');
329 $this->abstractConfigurationManager->getConfiguration('SomeOtherExtensionName', 'SomeOtherCurrentPluginName');
330 }
331
332 /**
333 * switchableControllerActions *
334 */
335 /**
336 * @test
337 */
338 public function switchableControllerActionsAreNotOverriddenIfPluginNameIsSpecified() {
339 /** @var \TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
340 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions', 'getRecursiveStoragePids'));
341 $abstractConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
342 $abstractConfigurationManager->setConfiguration(array('switchableControllerActions' => array('overriddenSwitchableControllerActions')));
343 $abstractConfigurationManager->expects($this->any())->method('getPluginConfiguration')->will($this->returnValue(array()));
344 $abstractConfigurationManager->expects($this->never())->method('overrideSwitchableControllerActions');
345 $abstractConfigurationManager->getConfiguration('SomeExtensionName', 'SomePluginName');
346 }
347
348 /**
349 * @test
350 */
351 public function switchableControllerActionsAreOverriddenIfSpecifiedPluginIsTheCurrentPlugin() {
352 /** @var \TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
353 $configuration = array('extensionName' => 'CurrentExtensionName', 'pluginName' => 'CurrentPluginName', 'switchableControllerActions' => array('overriddenSwitchableControllerActions'));
354 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions', 'getRecursiveStoragePids'));
355 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
356 $abstractConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
357 $abstractConfigurationManager->setConfiguration($configuration);
358 $abstractConfigurationManager->expects($this->any())->method('getPluginConfiguration')->will($this->returnValue(array()));
359 $abstractConfigurationManager->expects($this->once())->method('overrideSwitchableControllerActions');
360 $abstractConfigurationManager->getConfiguration('CurrentExtensionName', 'CurrentPluginName');
361 }
362
363 /**
364 * @test
365 */
366 public function switchableControllerActionsAreOverriddenIfPluginNameIsNotSpecified() {
367 /** @var \TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
368 $configuration = array('switchableControllerActions' => array('overriddenSwitchableControllerActions'));
369 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions', 'getRecursiveStoragePids'));
370 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
371 $abstractConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
372 $abstractConfigurationManager->setConfiguration($configuration);
373 $abstractConfigurationManager->expects($this->any())->method('getPluginConfiguration')->will($this->returnValue(array()));
374 $abstractConfigurationManager->expects($this->once())->method('overrideSwitchableControllerActions');
375 $abstractConfigurationManager->getConfiguration();
376 }
377
378 /**
379 * @test
380 */
381 public function orderOfActionsCanBeOverriddenForCurrentPlugin() {
382 $configuration = array(
383 'extensionName' => 'CurrentExtensionName',
384 'pluginName' => 'CurrentPluginName',
385 'switchableControllerActions' => array(
386 'Controller1' => array('action2', 'action1', 'action3')
387 )
388 );
389 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
390 $this->abstractConfigurationManager->setConfiguration($configuration);
391 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
392 $this->abstractConfigurationManager->expects($this->once())->method('getSwitchableControllerActions')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testSwitchableControllerActions));
393 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnCallBack(create_function('$a', 'return $a;')));
394 $mergedConfiguration = $this->abstractConfigurationManager->getConfiguration();
395 $expectedResult = array(
396 'Controller1' => array(
397 'actions' => array('action2', 'action1', 'action3')
398 )
399 );
400 $actualResult = $mergedConfiguration['controllerConfiguration'];
401 $this->assertEquals($expectedResult, $actualResult);
402 }
403
404 /**
405 * @test
406 */
407 public function newActionsCanBeAddedForCurrentPlugin() {
408 $configuration = array(
409 'extensionName' => 'CurrentExtensionName',
410 'pluginName' => 'CurrentPluginName',
411 'switchableControllerActions' => array(
412 'Controller1' => array('action2', 'action1', 'action3', 'newAction')
413 )
414 );
415 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
416 $this->abstractConfigurationManager->setConfiguration($configuration);
417 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
418 $this->abstractConfigurationManager->expects($this->once())->method('getSwitchableControllerActions')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testSwitchableControllerActions));
419 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnCallBack(create_function('$a', 'return $a;')));
420 $mergedConfiguration = $this->abstractConfigurationManager->getConfiguration();
421 $expectedResult = array(
422 'Controller1' => array(
423 'actions' => array('action2', 'action1', 'action3', 'newAction')
424 )
425 );
426 $actualResult = $mergedConfiguration['controllerConfiguration'];
427 $this->assertEquals($expectedResult, $actualResult);
428 }
429
430 /**
431 * @test
432 */
433 public function controllersCanNotBeOverridden() {
434 $configuration = array(
435 'extensionName' => 'CurrentExtensionName',
436 'pluginName' => 'CurrentPluginName',
437 'switchableControllerActions' => array(
438 'NewController' => array('action1', 'action2')
439 )
440 );
441 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
442 $this->abstractConfigurationManager->setConfiguration($configuration);
443 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
444 $this->abstractConfigurationManager->expects($this->once())->method('getSwitchableControllerActions')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testSwitchableControllerActions));
445 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnCallBack(create_function('$a', 'return $a;')));
446 $mergedConfiguration = $this->abstractConfigurationManager->getConfiguration();
447 $expectedResult = array();
448 $actualResult = $mergedConfiguration['controllerConfiguration'];
449 $this->assertEquals($expectedResult, $actualResult);
450 }
451
452 /**
453 * @test
454 */
455 public function cachingOfActionsCanNotBeChanged() {
456 $configuration = array(
457 'extensionName' => 'CurrentExtensionName',
458 'pluginName' => 'CurrentPluginName',
459 'switchableControllerActions' => array(
460 'Controller1' => array('newAction', 'action1'),
461 'Controller2' => array('newAction2', 'action4', 'action5')
462 )
463 );
464 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
465 $this->abstractConfigurationManager->setConfiguration($configuration);
466 $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
467 $this->abstractConfigurationManager->expects($this->once())->method('getSwitchableControllerActions')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testSwitchableControllerActions));
468 $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnCallBack(create_function('$a', 'return $a;')));
469 $mergedConfiguration = $this->abstractConfigurationManager->getConfiguration();
470 $expectedResult = array(
471 'Controller1' => array(
472 'actions' => array('newAction', 'action1')
473 ),
474 'Controller2' => array(
475 'actions' => array('newAction2', 'action4', 'action5'),
476 'nonCacheableActions' => array('action4')
477 )
478 );
479 $actualResult = $mergedConfiguration['controllerConfiguration'];
480 $this->assertEquals($expectedResult, $actualResult);
481 }
482
483 /**
484 * @test
485 */
486 public function getContentObjectReturnsNullIfNoContentObjectHasBeenSet() {
487 $this->assertNull($this->abstractConfigurationManager->getContentObject());
488 }
489
490 /**
491 * @test
492 */
493 public function getContentObjectTheCurrentContentObject() {
494 $mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
495 $this->abstractConfigurationManager->setContentObject($mockContentObject);
496 $this->assertSame($this->abstractConfigurationManager->getContentObject(), $mockContentObject);
497 }
498 }