/**
  * @test
  * @author Alexander Schnitzler <*****@*****.**>
  */
 public function overrideConfigurationFromPluginOverridesCorrectly()
 {
     /** @var $frontendConfigurationManager \TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager */
     $frontendConfigurationManager = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array('getTypoScriptSetup'));
     $frontendConfigurationManager->_set('contentObject', $this->mockContentObject);
     $frontendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
     $this->mockTypoScriptService->expects($this->once())->method('convertTypoScriptArrayToPlainArray')->will($this->returnValue(array('persistence' => array('storagePid' => '0,1,2,3'), 'settings' => array('foo' => 'bar'), 'view' => array('foo' => 'bar'))));
     $frontendConfigurationManager->expects($this->any())->method('getTypoScriptSetup')->will($this->returnValue(array('plugin.' => array('tx_ext_pi1.' => array('persistence.' => array('storagePid' => '0,1,2,3'), 'settings.' => array('foo' => 'bar'), 'view.' => array('foo' => 'bar'))))));
     $frameworkConfiguration = array('extensionName' => 'ext', 'pluginName' => 'pi1', 'persistence' => array('storagePid' => '1'), 'settings' => array('foo' => 'qux'), 'view' => array('foo' => 'qux'));
     $this->assertSame(array('extensionName' => 'ext', 'pluginName' => 'pi1', 'persistence' => array('storagePid' => '0,1,2,3'), 'settings' => array('foo' => 'bar'), 'view' => array('foo' => 'bar')), $frontendConfigurationManager->_call('overrideConfigurationFromPlugin', $frameworkConfiguration));
 }
 /**
  * @test
  */
 public function cachingOfActionsCanNotBeChanged()
 {
     $configuration = array('extensionName' => 'CurrentExtensionName', 'pluginName' => 'CurrentPluginName', 'switchableControllerActions' => array('Controller1' => array('newAction', 'action1'), 'Controller2' => array('newAction2', 'action4', 'action5')));
     $this->mockTypoScriptService->expects($this->any())->method('convertTypoScriptArrayToPlainArray')->with($configuration)->will($this->returnValue($configuration));
     $this->abstractConfigurationManager->setConfiguration($configuration);
     $this->abstractConfigurationManager->expects($this->once())->method('getPluginConfiguration')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testPluginConfiguration));
     $this->abstractConfigurationManager->expects($this->once())->method('getSwitchableControllerActions')->with('CurrentExtensionName', 'CurrentPluginName')->will($this->returnValue($this->testSwitchableControllerActions));
     $this->abstractConfigurationManager->expects($this->once())->method('getContextSpecificFrameworkConfiguration')->will($this->returnCallBack(create_function('$a', 'return $a;')));
     $mergedConfiguration = $this->abstractConfigurationManager->getConfiguration();
     $expectedResult = array('Controller1' => array('actions' => array('newAction', 'action1')), 'Controller2' => array('actions' => array('newAction2', 'action4', 'action5'), 'nonCacheableActions' => array('action4')));
     $actualResult = $mergedConfiguration['controllerConfiguration'];
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * @test
  */
 public function getPluginConfigurationRecursivelyMergesExtensionAndPluginConfiguration()
 {
     $testExtensionSettings = array('settings.' => array('foo' => 'bar', 'some.' => array('nested' => 'value')));
     $testExtensionSettingsConverted = array('settings' => array('foo' => 'bar', 'some' => array('nested' => 'value')));
     $testPluginSettings = array('settings.' => array('some.' => array('nested' => 'valueOverridde', 'new' => 'value')));
     $testPluginSettingsConverted = array('settings' => array('some' => array('nested' => 'valueOverridde', 'new' => 'value')));
     $testSetup = array('module.' => array('tx_someextensionname.' => $testExtensionSettings, '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));
     $this->backendConfigurationManager->expects($this->once())->method('getTypoScriptSetup')->will($this->returnValue($testSetup));
     $expectedResult = array('settings' => array('foo' => 'bar', 'some' => array('nested' => 'valueOverridde', 'new' => 'value')));
     $actualResult = $this->backendConfigurationManager->_call('getPluginConfiguration', 'SomeExtensionName', 'SomePluginName');
     $this->assertEquals($expectedResult, $actualResult);
 }