[TASK] Use name-resolution instead of strings where possible: 3
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Configuration / FrontendConfigurationManagerTest.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 FrontendConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer|\PHPUnit_Framework_MockObject_MockObject
24 */
25 protected $mockContentObject;
26
27 /**
28 * @var \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
29 */
30 protected $frontendConfigurationManager;
31
32 /**
33 * @var \TYPO3\CMS\Extbase\Service\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
34 */
35 protected $mockTypoScriptService;
36
37 /**
38 * Sets up this testcase
39 */
40 public function setUp() {
41 $GLOBALS['TSFE'] = new \stdClass();
42 $GLOBALS['TSFE']->tmpl = new \stdClass();
43 $this->mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, array('getTreeList'));
44 $this->frontendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('dummy'));
45 $this->frontendConfigurationManager->_set('contentObject', $this->mockContentObject);
46 $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
47 $this->frontendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
48 }
49
50 /**
51 * @test
52 */
53 public function getTypoScriptSetupReturnsSetupFromTsfe() {
54 $GLOBALS['TSFE']->tmpl->setup = array('foo' => 'bar');
55 $this->assertEquals(array('foo' => 'bar'), $this->frontendConfigurationManager->_call('getTypoScriptSetup'));
56 }
57
58 /**
59 * @test
60 */
61 public function getPluginConfigurationReturnsEmptyArrayIfNoPluginConfigurationWasFound() {
62 $GLOBALS['TSFE']->tmpl->setup = array('foo' => 'bar');
63 $expectedResult = array();
64 $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName', 'SomePluginName');
65 $this->assertEquals($expectedResult, $actualResult);
66 }
67
68 /**
69 * @test
70 */
71 public function getPluginConfigurationReturnsExtensionConfiguration() {
72 $testSettings = array(
73 'settings.' => array(
74 'foo' => 'bar'
75 )
76 );
77 $testSettingsConverted = array(
78 'settings' => array(
79 'foo' => 'bar'
80 )
81 );
82 $testSetup = array(
83 'plugin.' => array(
84 'tx_someextensionname.' => $testSettings
85 )
86 );
87 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
88 $GLOBALS['TSFE']->tmpl->setup = $testSetup;
89 $expectedResult = array(
90 'settings' => array(
91 'foo' => 'bar'
92 )
93 );
94 $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName');
95 $this->assertEquals($expectedResult, $actualResult);
96 }
97
98 /**
99 * @test
100 */
101 public function getPluginConfigurationReturnsPluginConfiguration() {
102 $testSettings = array(
103 'settings.' => array(
104 'foo' => 'bar'
105 )
106 );
107 $testSettingsConverted = array(
108 'settings' => array(
109 'foo' => 'bar'
110 )
111 );
112 $testSetup = array(
113 'plugin.' => array(
114 'tx_someextensionname_somepluginname.' => $testSettings
115 )
116 );
117 $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
118 $GLOBALS['TSFE']->tmpl->setup = $testSetup;
119 $expectedResult = array(
120 'settings' => array(
121 'foo' => 'bar'
122 )
123 );
124 $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName', 'SomePluginName');
125 $this->assertEquals($expectedResult, $actualResult);
126 }
127
128 /**
129 * @test
130 */
131 public function getPluginConfigurationRecursivelyMergesExtensionAndPluginConfiguration() {
132 $testExtensionSettings = array(
133 'settings.' => array(
134 'foo' => 'bar',
135 'some.' => array(
136 'nested' => 'value'
137 )
138 )
139 );
140 $testExtensionSettingsConverted = array(
141 'settings' => array(
142 'foo' => 'bar',
143 'some' => array(
144 'nested' => 'value'
145 )
146 )
147 );
148 $testPluginSettings = array(
149 'settings.' => array(
150 'some.' => array(
151 'nested' => 'valueOverridde',
152 'new' => 'value'
153 )
154 )
155 );
156 $testPluginSettingsConverted = array(
157 'settings' => array(
158 'some' => array(
159 'nested' => 'valueOverridde',
160 'new' => 'value'
161 )
162 )
163 );
164 $testSetup = array(
165 'plugin.' => array(
166 'tx_someextensionname.' => $testExtensionSettings,
167 'tx_someextensionname_somepluginname.' => $testPluginSettings
168 )
169 );
170 $this->mockTypoScriptService->expects($this->at(0))->method('convertTypoScriptArrayToPlainArray')->with($testExtensionSettings)->will($this->returnValue($testExtensionSettingsConverted));
171 $this->mockTypoScriptService->expects($this->at(1))->method('convertTypoScriptArrayToPlainArray')->with($testPluginSettings)->will($this->returnValue($testPluginSettingsConverted));
172 $GLOBALS['TSFE']->tmpl->setup = $testSetup;
173 $expectedResult = array(
174 'settings' => array(
175 'foo' => 'bar',
176 'some' => array(
177 'nested' => 'valueOverridde',
178 'new' => 'value'
179 )
180 )
181 );
182 $actualResult = $this->frontendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName', 'SomePluginName');
183 $this->assertEquals($expectedResult, $actualResult);
184 }
185
186 /**
187 * @test
188 */
189 public function getSwitchableControllerActionsReturnsEmptyArrayByDefault() {
190 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase'] = NULL;
191 $expectedResult = array();
192 $actualResult = $this->frontendConfigurationManager->_call('getSwitchableControllerActions', 'SomeExtensionName', 'SomePluginName');
193 $this->assertEquals($expectedResult, $actualResult);
194 }
195
196 /**
197 * @test
198 */
199 public function getSwitchableControllerActionsReturnsConfigurationStoredInExtconf() {
200 $testSwitchableControllerActions = array(
201 'Controller1' => array(
202 'actions' => array(
203 'action1',
204 'action2'
205 ),
206 'nonCacheableActions' => array(
207 'action1'
208 )
209 ),
210 'Controller2' => array(
211 'actions' => array(
212 'action3',
213 'action4'
214 )
215 )
216 );
217 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['SomeExtensionName']['plugins']['SomePluginName']['controllers'] = $testSwitchableControllerActions;
218 $expectedResult = $testSwitchableControllerActions;
219 $actualResult = $this->frontendConfigurationManager->_call('getSwitchableControllerActions', 'SomeExtensionName', 'SomePluginName');
220 $this->assertEquals($expectedResult, $actualResult);
221 }
222
223 /**
224 * @test
225 */
226 public function overrideSwitchableControllerActionsFromFlexFormReturnsUnchangedFrameworkConfigurationIfNoFlexFormConfigurationIsFound() {
227 $frameworkConfiguration = array(
228 'pluginName' => 'Pi1',
229 'extensionName' => 'SomeExtension',
230 'controllerConfiguration' => array(
231 'Controller1' => array(
232 'controller' => 'Controller1',
233 'actions' => 'action1 , action2'
234 ),
235 'Controller2' => array(
236 'controller' => 'Controller2',
237 'actions' => 'action2 , action1,action3',
238 'nonCacheableActions' => 'action2, action3'
239 )
240 )
241 );
242 $flexFormConfiguration = array();
243 $actualResult = $this->frontendConfigurationManager->_call('overrideSwitchableControllerActionsFromFlexForm', $frameworkConfiguration, $flexFormConfiguration);
244 $this->assertSame($frameworkConfiguration, $actualResult);
245 }
246
247 /**
248 * @test
249 */
250 public function overrideSwitchableControllerActionsFromFlexFormMergesNonCacheableActions() {
251 $frameworkConfiguration = array(
252 'pluginName' => 'Pi1',
253 'extensionName' => 'SomeExtension',
254 'controllerConfiguration' => array(
255 'Controller1' => array(
256 'actions' => array('action1 , action2')
257 ),
258 'Controller2' => array(
259 'actions' => array('action2', 'action1', 'action3'),
260 'nonCacheableActions' => array('action2', 'action3')
261 )
262 )
263 );
264 $flexFormConfiguration = array(
265 'switchableControllerActions' => 'Controller1 -> action2;Controller2->action3; Controller2->action1'
266 );
267 $expectedResult = array(
268 'pluginName' => 'Pi1',
269 'extensionName' => 'SomeExtension',
270 'controllerConfiguration' => array(
271 'Controller1' => array(
272 'actions' => array('action2')
273 ),
274 'Controller2' => array(
275 'actions' => array('action3', 'action1'),
276 'nonCacheableActions' => array(1 => 'action3')
277 )
278 )
279 );
280 $actualResult = $this->frontendConfigurationManager->_call('overrideSwitchableControllerActionsFromFlexForm', $frameworkConfiguration, $flexFormConfiguration);
281 $this->assertEquals($expectedResult, $actualResult);
282 }
283
284 /**
285 * @test
286 * @expectedException \TYPO3\CMS\Extbase\Configuration\Exception\ParseErrorException
287 */
288 public function overrideSwitchableControllerActionsThrowsExceptionIfFlexFormConfigurationIsInvalid() {
289 $frameworkConfiguration = array(
290 'pluginName' => 'Pi1',
291 'extensionName' => 'SomeExtension',
292 'controllerConfiguration' => array(
293 'Controller1' => array(
294 'actions' => array('action1 , action2')
295 ),
296 'Controller2' => array(
297 'actions' => array('action2', 'action1', 'action3'),
298 'nonCacheableActions' => array('action2', 'action3')
299 )
300 )
301 );
302 $flexFormConfiguration = array(
303 'switchableControllerActions' => 'Controller1->;Controller2->action3;Controller2->action1'
304 );
305 $this->frontendConfigurationManager->_call('overrideSwitchableControllerActionsFromFlexForm', $frameworkConfiguration, $flexFormConfiguration);
306 }
307
308 /**
309 * @test
310 */
311 public function getContextSpecificFrameworkConfigurationCorrectlyCallsOverrideMethods() {
312 $frameworkConfiguration = array(
313 'some' => array(
314 'framework' => 'configuration'
315 )
316 );
317 /** @var \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
318 $frontendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('overrideStoragePidIfStartingPointIsSet', 'overrideConfigurationFromPlugin', 'overrideConfigurationFromFlexForm'));
319 $frontendConfigurationManager->expects($this->at(0))->method('overrideStoragePidIfStartingPointIsSet')->with($frameworkConfiguration)->will($this->returnValue(array('overridden' => 'storagePid')));
320 $frontendConfigurationManager->expects($this->at(1))->method('overrideConfigurationFromPlugin')->with(array('overridden' => 'storagePid'))->will($this->returnValue(array('overridden' => 'pluginConfiguration')));
321 $frontendConfigurationManager->expects($this->at(2))->method('overrideConfigurationFromFlexForm')->with(array('overridden' => 'pluginConfiguration'))->will($this->returnValue(array('overridden' => 'flexFormConfiguration')));
322 $expectedResult = array('overridden' => 'flexFormConfiguration');
323 $actualResult = $frontendConfigurationManager->_call('getContextSpecificFrameworkConfiguration', $frameworkConfiguration);
324 $this->assertEquals($expectedResult, $actualResult);
325 }
326
327 /**
328 * @test
329 */
330 public function storagePidsAreExtendedIfRecursiveSearchIsConfigured() {
331 $storagePid = '3,5,9';
332 $recursive = 99;
333 /** @var $abstractConfigurationManager \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager */
334 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions'));
335 /** @var $cObjectMock \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
336 $cObjectMock = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
337 $cObjectMock->expects($this->any())
338 ->method('getTreeList')
339 ->will($this->onConsecutiveCalls('4', '', '898,12'));
340 $abstractConfigurationManager->setContentObject($cObjectMock);
341
342 $expectedResult = '4,898,12';
343 $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive);
344 $this->assertEquals($expectedResult, $actualResult);
345 }
346
347 /**
348 * @test
349 */
350 public function storagePidsAreExtendedIfRecursiveSearchIsConfiguredAndWithPidIncludedForNegativePid() {
351 $storagePid = '-3,5,9';
352 $recursive = 99;
353 /** @var $abstractConfigurationManager \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager */
354 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions'));
355 /** @var $cObjectMock \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
356 $cObjectMock = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
357 $cObjectMock->expects($this->any())
358 ->method('getTreeList')
359 ->will($this->onConsecutiveCalls('3,4', '', '898,12'));
360 $abstractConfigurationManager->setContentObject($cObjectMock);
361
362 $expectedResult = '3,4,898,12';
363 $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive);
364 $this->assertEquals($expectedResult, $actualResult);
365 }
366
367 /**
368 * @test
369 */
370 public function storagePidsAreNotExtendedIfRecursiveSearchIsNotConfigured() {
371 $storagePid = '1,2,3';
372
373 /** @var $abstractConfigurationManager \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager */
374 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions'));
375 /** @var $cObjectMock \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
376 $cObjectMock = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
377 $cObjectMock->expects($this->never())->method('getTreeList');
378 $abstractConfigurationManager->setContentObject($cObjectMock);
379
380 $expectedResult = '1,2,3';
381 $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid);
382 $this->assertEquals($expectedResult, $actualResult);
383 }
384
385 /**
386 * @test
387 */
388 public function storagePidsAreNotExtendedIfRecursiveSearchIsConfiguredForZeroLevels() {
389 $storagePid = '1,2,3';
390 $recursive = 0;
391
392 $abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('overrideSwitchableControllerActions', 'getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions'));
393
394 /** @var $cObjectMock \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
395 $cObjectMock = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
396 $cObjectMock->expects($this->never())->method('getTreeList');
397 $abstractConfigurationManager->setContentObject($cObjectMock);
398
399 $expectedResult = '1,2,3';
400 $actualResult = $abstractConfigurationManager->_call('getRecursiveStoragePids', $storagePid, $recursive);
401 $this->assertEquals($expectedResult, $actualResult);
402 }
403
404 /**
405 * @test
406 * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
407 */
408 public function mergeConfigurationIntoFrameworkConfigurationWorksAsExpected() {
409 $configuration = array(
410 'persistence' => array(
411 'storagePid' => '0,1,2,3'
412 )
413 );
414
415 $frameworkConfiguration = array('persistence' => array('storagePid' => '98'));
416 $this->assertSame(
417 array('persistence' => array('storagePid' => '0,1,2,3')),
418 $this->frontendConfigurationManager->_call('mergeConfigurationIntoFrameworkConfiguration', $frameworkConfiguration, $configuration, 'persistence')
419 );
420 }
421
422 /**
423 * @test
424 * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
425 */
426 public function overrideStoragePidIfStartingPointIsSetOverridesCorrectly() {
427 $this->mockContentObject->expects($this->any())->method('getTreeList')->will($this->returnValue('1,2,3'));
428 $this->mockContentObject->data = array('pages' => '0', 'recursive' => 1);
429
430 $frameworkConfiguration = array('persistence' => array('storagePid' => '98'));
431 $this->assertSame(
432 array('persistence' => array('storagePid' => '0,1,2,3')),
433 $this->frontendConfigurationManager->_call('overrideStoragePidIfStartingPointIsSet', $frameworkConfiguration)
434 );
435 }
436
437 /**
438 * @test
439 */
440 public function overrideConfigurationFromFlexFormChecksForDataIsString() {
441 /** @var $flexFormService \TYPO3\CMS\Extbase\Service\FlexFormService|\PHPUnit_Framework_MockObject_MockObject */
442 $flexFormService = $this->getMock(\TYPO3\CMS\Extbase\Service\FlexFormService::class, array('convertFlexFormContentToArray'));
443 $flexFormService->expects($this->once())->method('convertFlexFormContentToArray')->will($this->returnValue(array(
444 'persistence' => array(
445 'storagePid' => '0,1,2,3'
446 )
447 )));
448
449 $this->frontendConfigurationManager->_set('flexFormService', $flexFormService);
450 $this->mockContentObject->data = array('pi_flexform' => '<XML_ARRAY>');
451
452 $frameworkConfiguration = array('persistence' => array('storagePid' => '98'));
453 $this->assertSame(
454 array('persistence' => array('storagePid' => '0,1,2,3')),
455 $this->frontendConfigurationManager->_call('overrideConfigurationFromFlexForm', $frameworkConfiguration)
456 );
457 }
458
459 /**
460 * @test
461 */
462 public function overrideConfigurationFromFlexFormChecksForDataIsStringAndEmpty() {
463 /** @var $flexFormService \TYPO3\CMS\Extbase\Service\FlexFormService|\PHPUnit_Framework_MockObject_MockObject */
464 $flexFormService = $this->getMock(\TYPO3\CMS\Extbase\Service\FlexFormService::class, array('convertFlexFormContentToArray'));
465 $flexFormService->expects($this->never())->method('convertFlexFormContentToArray');
466
467 $this->frontendConfigurationManager->_set('flexFormService', $flexFormService);
468 $this->mockContentObject->data = array('pi_flexform' => '');
469
470 $frameworkConfiguration = array('persistence' => array('storagePid' => '98'));
471 $this->assertSame(
472 array('persistence' => array('storagePid' => '98')),
473 $this->frontendConfigurationManager->_call('overrideConfigurationFromFlexForm', $frameworkConfiguration)
474 );
475 }
476
477 /**
478 * @test
479 */
480 public function overrideConfigurationFromFlexFormChecksForDataIsArray() {
481 /** @var $flexFormService \TYPO3\CMS\Extbase\Service\FlexFormService|\PHPUnit_Framework_MockObject_MockObject */
482 $flexFormService = $this->getMock(\TYPO3\CMS\Extbase\Service\FlexFormService::class, array('convertFlexFormContentToArray'));
483 $flexFormService->expects($this->never())->method('convertFlexFormContentToArray');
484
485 $this->frontendConfigurationManager->_set('flexFormService', $flexFormService);
486 $this->mockContentObject->data = array('pi_flexform' => array('persistence' => array('storagePid' => '0,1,2,3')));
487
488 $frameworkConfiguration = array('persistence' => array('storagePid' => '98'));
489 $this->assertSame(
490 array('persistence' => array('storagePid' => '0,1,2,3')),
491 $this->frontendConfigurationManager->_call('overrideConfigurationFromFlexForm', $frameworkConfiguration)
492 );
493 }
494
495 /**
496 * @test
497 */
498 public function overrideConfigurationFromFlexFormChecksForDataIsArrayAndEmpty() {
499 /** @var $flexFormService \TYPO3\CMS\Extbase\Service\FlexFormService|\PHPUnit_Framework_MockObject_MockObject */
500 $flexFormService = $this->getMock(\TYPO3\CMS\Extbase\Service\FlexFormService::class, array('convertFlexFormContentToArray'));
501 $flexFormService->expects($this->never())->method('convertFlexFormContentToArray');
502
503 $this->frontendConfigurationManager->_set('flexFormService', $flexFormService);
504 $this->mockContentObject->data = array('pi_flexform' => array());
505
506 $frameworkConfiguration = array('persistence' => array('storagePid' => '98'));
507 $this->assertSame(
508 array('persistence' => array('storagePid' => '98')),
509 $this->frontendConfigurationManager->_call('overrideConfigurationFromFlexForm', $frameworkConfiguration)
510 );
511 }
512
513 /**
514 * @test
515 * @author Alexander Schnitzler <alex.schnitzler@typovision.de>
516 */
517 public function overrideConfigurationFromPluginOverridesCorrectly() {
518 /** @var $frontendConfigurationManager \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager */
519 $frontendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, array('getTypoScriptSetup'));
520 $frontendConfigurationManager->_set('contentObject', $this->mockContentObject);
521 $frontendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
522
523 $this->mockTypoScriptService->expects($this->once())->method('convertTypoScriptArrayToPlainArray')->will($this->returnValue(array(
524 'persistence' => array(
525 'storagePid' => '0,1,2,3'
526 ),
527 'settings' => array(
528 'foo' => 'bar'
529 ),
530 'view' => array(
531 'foo' => 'bar'
532 ),
533 )));
534 $frontendConfigurationManager->expects($this->any())->method('getTypoScriptSetup')->will($this->returnValue(array(
535 'plugin.' => array(
536 'tx_ext_pi1.' => array(
537 'persistence.' => array(
538 'storagePid' => '0,1,2,3'
539 ),
540 'settings.' => array(
541 'foo' => 'bar'
542 ),
543 'view.' => array(
544 'foo' => 'bar'
545 ),
546 )
547 )
548 )));
549
550 $frameworkConfiguration = array(
551 'extensionName' => 'ext',
552 'pluginName' => 'pi1',
553 'persistence' => array(
554 'storagePid' => '1'
555 ),
556 'settings' => array(
557 'foo' => 'qux'
558 ),
559 'view' => array(
560 'foo' => 'qux'
561 ),
562 );
563 $this->assertSame(
564 array(
565 'extensionName' => 'ext',
566 'pluginName' => 'pi1',
567 'persistence' => array(
568 'storagePid' => '0,1,2,3',
569 ),
570 'settings' => array(
571 'foo' => 'bar'
572 ),
573 'view' => array(
574 'foo' => 'bar'
575 ),
576 ),
577 $frontendConfigurationManager->_call('overrideConfigurationFromPlugin', $frameworkConfiguration)
578 );
579 }
580 }