42 $GLOBALS[
'TSFE']->tmpl = new \stdClass();
43 $this->mockContentObject = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(
'getTreeList'));
44 $this->frontendConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array(
'dummy'));
45 $this->frontendConfigurationManager->_set(
'contentObject', $this->mockContentObject);
46 $this->mockTypoScriptService = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
47 $this->frontendConfigurationManager->_set(
'typoScriptService', $this->mockTypoScriptService);
54 $GLOBALS[
'TSFE']->tmpl->setup = array(
'foo' =>
'bar');
55 $this->assertEquals(array(
'foo' =>
'bar'), $this->frontendConfigurationManager->_call(
'getTypoScriptSetup'));
62 $GLOBALS[
'TSFE']->tmpl->setup = array(
'foo' =>
'bar');
63 $expectedResult = array();
64 $actualResult = $this->frontendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName',
'SomePluginName');
65 $this->assertEquals($expectedResult, $actualResult);
72 $testSettings = array(
77 $testSettingsConverted = array(
84 'tx_someextensionname.' => $testSettings
87 $this->mockTypoScriptService->expects($this->any())->method(
'convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
88 $GLOBALS[
'TSFE']->tmpl->setup = $testSetup;
89 $expectedResult = array(
94 $actualResult = $this->frontendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName');
95 $this->assertEquals($expectedResult, $actualResult);
102 $testSettings = array(
103 'settings.' => array(
107 $testSettingsConverted = array(
114 'tx_someextensionname_somepluginname.' => $testSettings
117 $this->mockTypoScriptService->expects($this->any())->method(
'convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
118 $GLOBALS[
'TSFE']->tmpl->setup = $testSetup;
119 $expectedResult = array(
124 $actualResult = $this->frontendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName',
'SomePluginName');
125 $this->assertEquals($expectedResult, $actualResult);
132 $testExtensionSettings = array(
133 'settings.' => array(
140 $testExtensionSettingsConverted = array(
148 $testPluginSettings = array(
149 'settings.' => array(
151 'nested' =>
'valueOverridde',
156 $testPluginSettingsConverted = array(
159 'nested' =>
'valueOverridde',
166 'tx_someextensionname.' => $testExtensionSettings,
167 'tx_someextensionname_somepluginname.' => $testPluginSettings
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(
177 'nested' =>
'valueOverridde',
182 $actualResult = $this->frontendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName',
'SomePluginName');
183 $this->assertEquals($expectedResult, $actualResult);
190 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'] = NULL;
191 $expectedResult = array();
192 $actualResult = $this->frontendConfigurationManager->_call(
'getSwitchableControllerActions',
'SomeExtensionName',
'SomePluginName');
193 $this->assertEquals($expectedResult, $actualResult);
200 $testSwitchableControllerActions = array(
201 'Controller1' => array(
206 'nonCacheableActions' => array(
210 'Controller2' => array(
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);
227 $frameworkConfiguration = array(
228 'pluginName' =>
'Pi1',
229 'extensionName' =>
'SomeExtension',
230 'controllerConfiguration' => array(
231 'Controller1' => array(
232 'controller' =>
'Controller1',
233 'actions' =>
'action1 , action2' 235 'Controller2' => array(
236 'controller' =>
'Controller2',
237 'actions' =>
'action2 , action1,action3',
238 'nonCacheableActions' =>
'action2, action3' 242 $flexFormConfiguration = array();
243 $actualResult = $this->frontendConfigurationManager->_call(
'overrideSwitchableControllerActionsFromFlexForm', $frameworkConfiguration, $flexFormConfiguration);
244 $this->assertSame($frameworkConfiguration, $actualResult);
251 $frameworkConfiguration = array(
252 'pluginName' =>
'Pi1',
253 'extensionName' =>
'SomeExtension',
254 'controllerConfiguration' => array(
255 'Controller1' => array(
256 'actions' => array(
'action1 , action2')
258 'Controller2' => array(
259 'actions' => array(
'action2',
'action1',
'action3'),
260 'nonCacheableActions' => array(
'action2',
'action3')
264 $flexFormConfiguration = array(
265 'switchableControllerActions' =>
'Controller1 -> action2;Controller2->action3; Controller2->action1' 267 $expectedResult = array(
268 'pluginName' =>
'Pi1',
269 'extensionName' =>
'SomeExtension',
270 'controllerConfiguration' => array(
271 'Controller1' => array(
272 'actions' => array(
'action2')
274 'Controller2' => array(
275 'actions' => array(
'action3',
'action1'),
276 'nonCacheableActions' => array(1 =>
'action3')
280 $actualResult = $this->frontendConfigurationManager->_call(
'overrideSwitchableControllerActionsFromFlexForm', $frameworkConfiguration, $flexFormConfiguration);
281 $this->assertEquals($expectedResult, $actualResult);
289 $frameworkConfiguration = array(
290 'pluginName' =>
'Pi1',
291 'extensionName' =>
'SomeExtension',
292 'controllerConfiguration' => array(
293 'Controller1' => array(
294 'actions' => array(
'action1 , action2')
296 'Controller2' => array(
297 'actions' => array(
'action2',
'action1',
'action3'),
298 'nonCacheableActions' => array(
'action2',
'action3')
302 $flexFormConfiguration = array(
303 'switchableControllerActions' =>
'Controller1->;Controller2->action3;Controller2->action1' 305 $this->frontendConfigurationManager->_call(
'overrideSwitchableControllerActionsFromFlexForm', $frameworkConfiguration, $flexFormConfiguration);
311 public function getContextSpecificFrameworkConfigurationCorrectlyCallsOverrideMethods() {
312 $frameworkConfiguration = array(
314 'framework' =>
'configuration' 318 $frontendConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', 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');
324 $this->assertEquals($expectedResult, $actualResult);
330 public function storagePidsAreExtendedIfRecursiveSearchIsConfigured() {
331 $storagePid =
'3,5,9';
334 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
336 $cObjectMock = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
337 $cObjectMock->expects($this->any())
338 ->method(
'getTreeList')
339 ->will($this->onConsecutiveCalls(
'4',
'',
'898,12'));
340 $abstractConfigurationManager->setContentObject($cObjectMock);
342 $expectedResult =
'4,898,12';
343 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid, $recursive);
344 $this->assertEquals($expectedResult, $actualResult);
350 public function storagePidsAreExtendedIfRecursiveSearchIsConfiguredAndWithPidIncludedForNegativePid() {
351 $storagePid =
'-3,5,9';
354 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
356 $cObjectMock = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
357 $cObjectMock->expects($this->any())
358 ->method(
'getTreeList')
359 ->will($this->onConsecutiveCalls(
'3,4',
'',
'898,12'));
360 $abstractConfigurationManager->setContentObject($cObjectMock);
362 $expectedResult =
'3,4,898,12';
363 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid, $recursive);
364 $this->assertEquals($expectedResult, $actualResult);
370 public function storagePidsAreNotExtendedIfRecursiveSearchIsNotConfigured() {
371 $storagePid =
'1,2,3';
374 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
376 $cObjectMock = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
377 $cObjectMock->expects($this->never())->method(
'getTreeList');
378 $abstractConfigurationManager->setContentObject($cObjectMock);
380 $expectedResult =
'1,2,3';
381 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid);
382 $this->assertEquals($expectedResult, $actualResult);
388 public function storagePidsAreNotExtendedIfRecursiveSearchIsConfiguredForZeroLevels() {
389 $storagePid =
'1,2,3';
392 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
395 $cObjectMock = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
396 $cObjectMock->expects($this->never())->method(
'getTreeList');
397 $abstractConfigurationManager->setContentObject($cObjectMock);
399 $expectedResult =
'1,2,3';
400 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid, $recursive);
401 $this->assertEquals($expectedResult, $actualResult);
409 $configuration = array(
410 'persistence' => array(
411 'storagePid' =>
'0,1,2,3' 415 $frameworkConfiguration = array(
'persistence' => array(
'storagePid' =>
'98'));
417 array(
'persistence' => array(
'storagePid' =>
'0,1,2,3')),
418 $this->frontendConfigurationManager->_call(
'mergeConfigurationIntoFrameworkConfiguration', $frameworkConfiguration, $configuration,
'persistence')
427 $this->mockContentObject->expects($this->any())->method(
'getTreeList')->will($this->returnValue(
'1,2,3'));
428 $this->mockContentObject->data = array(
'pages' =>
'0',
'recursive' => 1);
430 $frameworkConfiguration = array(
'persistence' => array(
'storagePid' =>
'98'));
432 array(
'persistence' => array(
'storagePid' =>
'0,1,2,3')),
433 $this->frontendConfigurationManager->_call(
'overrideStoragePidIfStartingPointIsSet', $frameworkConfiguration)
440 public function overrideConfigurationFromFlexFormChecksForDataIsString() {
442 $flexFormService = $this->getMock(
'TYPO3\CMS\Extbase\Service\FlexFormService', array(
'convertFlexFormContentToArray'));
443 $flexFormService->expects($this->once())->method(
'convertFlexFormContentToArray')->will($this->returnValue(array(
444 'persistence' => array(
445 'storagePid' =>
'0,1,2,3' 449 $this->frontendConfigurationManager->_set(
'flexFormService', $flexFormService);
450 $this->mockContentObject->data = array(
'pi_flexform' =>
'<XML_ARRAY>');
452 $frameworkConfiguration = array(
'persistence' => array(
'storagePid' =>
'98'));
454 array(
'persistence' => array(
'storagePid' =>
'0,1,2,3')),
455 $this->frontendConfigurationManager->_call(
'overrideConfigurationFromFlexForm', $frameworkConfiguration)
462 public function overrideConfigurationFromFlexFormChecksForDataIsStringAndEmpty() {
464 $flexFormService = $this->getMock(
'TYPO3\CMS\Extbase\Service\FlexFormService', array(
'convertFlexFormContentToArray'));
465 $flexFormService->expects($this->never())->method(
'convertFlexFormContentToArray');
467 $this->frontendConfigurationManager->_set(
'flexFormService', $flexFormService);
468 $this->mockContentObject->data = array(
'pi_flexform' =>
'');
470 $frameworkConfiguration = array(
'persistence' => array(
'storagePid' =>
'98'));
472 array(
'persistence' => array(
'storagePid' =>
'98')),
473 $this->frontendConfigurationManager->_call(
'overrideConfigurationFromFlexForm', $frameworkConfiguration)
480 public function overrideConfigurationFromFlexFormChecksForDataIsArray() {
482 $flexFormService = $this->getMock(
'TYPO3\CMS\Extbase\Service\FlexFormService', array(
'convertFlexFormContentToArray'));
483 $flexFormService->expects($this->never())->method(
'convertFlexFormContentToArray');
485 $this->frontendConfigurationManager->_set(
'flexFormService', $flexFormService);
486 $this->mockContentObject->data = array(
'pi_flexform' => array(
'persistence' => array(
'storagePid' =>
'0,1,2,3')));
488 $frameworkConfiguration = array(
'persistence' => array(
'storagePid' =>
'98'));
490 array(
'persistence' => array(
'storagePid' =>
'0,1,2,3')),
491 $this->frontendConfigurationManager->_call(
'overrideConfigurationFromFlexForm', $frameworkConfiguration)
498 public function overrideConfigurationFromFlexFormChecksForDataIsArrayAndEmpty() {
500 $flexFormService = $this->getMock(
'TYPO3\CMS\Extbase\Service\FlexFormService', array(
'convertFlexFormContentToArray'));
501 $flexFormService->expects($this->never())->method(
'convertFlexFormContentToArray');
503 $this->frontendConfigurationManager->_set(
'flexFormService', $flexFormService);
504 $this->mockContentObject->data = array(
'pi_flexform' => array());
506 $frameworkConfiguration = array(
'persistence' => array(
'storagePid' =>
'98'));
508 array(
'persistence' => array(
'storagePid' =>
'98')),
509 $this->frontendConfigurationManager->_call(
'overrideConfigurationFromFlexForm', $frameworkConfiguration)
517 public function overrideConfigurationFromPluginOverridesCorrectly() {
523 $this->mockTypoScriptService->expects($this->once())->method(
'convertTypoScriptArrayToPlainArray')->will($this->returnValue(array(
524 'persistence' => array(
525 'storagePid' =>
'0,1,2,3' 536 'tx_ext_pi1.' => array(
537 'persistence.' => array(
538 'storagePid' =>
'0,1,2,3' 540 'settings.' => array(
550 $frameworkConfiguration = array(
551 'extensionName' =>
'ext',
552 'pluginName' =>
'pi1',
553 'persistence' => array(
565 'extensionName' =>
'ext',
566 'pluginName' =>
'pi1',
567 'persistence' => array(
568 'storagePid' =>
'0,1,2,3',
mergeConfigurationIntoFrameworkConfigurationWorksAsExpected()
getPluginConfigurationReturnsPluginConfiguration()
getSwitchableControllerActionsReturnsEmptyArrayByDefault()
getPluginConfigurationRecursivelyMergesExtensionAndPluginConfiguration()
$frontendConfigurationManager
getSwitchableControllerActionsReturnsConfigurationStoredInExtconf()
overrideSwitchableControllerActionsFromFlexFormReturnsUnchangedFrameworkConfigurationIfNoFlexFormConfigurationIsFound()
overrideStoragePidIfStartingPointIsSetOverridesCorrectly()
overrideSwitchableControllerActionsFromFlexFormMergesNonCacheableActions()
getTypoScriptSetupReturnsSetupFromTsfe()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
getPluginConfigurationReturnsEmptyArrayIfNoPluginConfigurationWasFound()
overrideSwitchableControllerActionsThrowsExceptionIfFlexFormConfigurationIsInvalid()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
getPluginConfigurationReturnsExtensionConfiguration()