36 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array());
37 $this->backendConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array(
'getTypoScriptSetup'));
38 $this->mockTypoScriptService = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
39 $this->backendConfigurationManager->_set(
'typoScriptService', $this->mockTypoScriptService);
47 $expectedResult = 123;
48 $actualResult = $this->backendConfigurationManager->_call(
'getCurrentPageId');
49 $this->assertEquals($expectedResult, $actualResult);
58 $expectedResult = 321;
59 $actualResult = $this->backendConfigurationManager->_call(
'getCurrentPageId');
60 $this->assertEquals($expectedResult, $actualResult);
67 $GLOBALS[
'TYPO3_DB']->expects($this->at(0))->method(
'exec_SELECTgetSingleRow')->with(
'uid',
'pages',
'deleted=0 AND hidden=0 AND is_siteroot=1',
'',
'sorting')->will($this->returnValue(array()));
68 $GLOBALS[
'TYPO3_DB']->expects($this->at(1))->method(
'exec_SELECTgetSingleRow')->with(
'pid',
'sys_template',
'deleted=0 AND hidden=0 AND root=1',
'',
'crdate')->will($this->returnValue(
71 $expectedResult = 123;
72 $actualResult = $this->backendConfigurationManager->_call(
'getCurrentPageId');
73 $this->assertEquals($expectedResult, $actualResult);
80 $GLOBALS[
'TYPO3_DB']->expects($this->once())->method(
'exec_SELECTgetSingleRow')->with(
'uid',
'pages',
'deleted=0 AND hidden=0 AND is_siteroot=1',
'',
'sorting')->will($this->returnValue(
83 $expectedResult = 321;
84 $actualResult = $this->backendConfigurationManager->_call(
'getCurrentPageId');
85 $this->assertEquals($expectedResult, $actualResult);
92 $GLOBALS[
'TYPO3_DB']->expects($this->at(0))->method(
'exec_SELECTgetSingleRow')->with(
'uid',
'pages',
'deleted=0 AND hidden=0 AND is_siteroot=1',
'',
'sorting')->will($this->returnValue(array()));
93 $GLOBALS[
'TYPO3_DB']->expects($this->at(1))->method(
'exec_SELECTgetSingleRow')->with(
'pid',
'sys_template',
'deleted=0 AND hidden=0 AND root=1',
'',
'crdate')->will($this->returnValue(array()));
95 $actualResult = $this->backendConfigurationManager->_call(
'getCurrentPageId');
96 $this->assertEquals($expectedResult, $actualResult);
103 $this->backendConfigurationManager->expects($this->once())->method(
'getTypoScriptSetup')->will($this->returnValue(array(
'foo' =>
'bar')));
104 $expectedResult = array();
105 $actualResult = $this->backendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName',
'SomePluginName');
106 $this->assertEquals($expectedResult, $actualResult);
113 $testSettings = array(
114 'settings.' => array(
118 $testSettingsConverted = array(
125 'tx_someextensionname.' => $testSettings
128 $this->mockTypoScriptService->expects($this->any())->method(
'convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
129 $this->backendConfigurationManager->expects($this->once())->method(
'getTypoScriptSetup')->will($this->returnValue($testSetup));
130 $expectedResult = array(
135 $actualResult = $this->backendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName');
136 $this->assertEquals($expectedResult, $actualResult);
143 $testSettings = array(
144 'settings.' => array(
148 $testSettingsConverted = array(
155 'tx_someextensionname_somepluginname.' => $testSettings
158 $this->mockTypoScriptService->expects($this->any())->method(
'convertTypoScriptArrayToPlainArray')->with($testSettings)->will($this->returnValue($testSettingsConverted));
159 $this->backendConfigurationManager->expects($this->once())->method(
'getTypoScriptSetup')->will($this->returnValue($testSetup));
160 $expectedResult = array(
165 $actualResult = $this->backendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName',
'SomePluginName');
166 $this->assertEquals($expectedResult, $actualResult);
173 $testExtensionSettings = array(
174 'settings.' => array(
181 $testExtensionSettingsConverted = array(
189 $testPluginSettings = array(
190 'settings.' => array(
192 'nested' =>
'valueOverridde',
197 $testPluginSettingsConverted = array(
200 'nested' =>
'valueOverridde',
207 'tx_someextensionname.' => $testExtensionSettings,
208 'tx_someextensionname_somepluginname.' => $testPluginSettings
211 $this->mockTypoScriptService->expects($this->at(0))->method(
'convertTypoScriptArrayToPlainArray')->with($testExtensionSettings)->will($this->returnValue($testExtensionSettingsConverted));
212 $this->mockTypoScriptService->expects($this->at(1))->method(
'convertTypoScriptArrayToPlainArray')->with($testPluginSettings)->will($this->returnValue($testPluginSettingsConverted));
213 $this->backendConfigurationManager->expects($this->once())->method(
'getTypoScriptSetup')->will($this->returnValue($testSetup));
214 $expectedResult = array(
218 'nested' =>
'valueOverridde',
223 $actualResult = $this->backendConfigurationManager->_call(
'getPluginConfiguration',
'SomeExtensionName',
'SomePluginName');
224 $this->assertEquals($expectedResult, $actualResult);
231 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'] = NULL;
232 $expectedResult = array();
233 $actualResult = $this->backendConfigurationManager->_call(
'getSwitchableControllerActions',
'SomeExtensionName',
'SomePluginName');
234 $this->assertEquals($expectedResult, $actualResult);
241 $testSwitchableControllerActions = array(
242 'Controller1' => array(
247 'nonCacheableActions' => array(
251 'Controller2' => array(
258 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][
'SomeExtensionName'][
'modules'][
'SomePluginName'][
'controllers'] = $testSwitchableControllerActions;
259 $expectedResult = $testSwitchableControllerActions;
260 $actualResult = $this->backendConfigurationManager->_call(
'getSwitchableControllerActions',
'SomeExtensionName',
'SomePluginName');
261 $this->assertEquals($expectedResult, $actualResult);
268 $frameworkConfiguration = array(
269 'pluginName' =>
'Pi1',
270 'extensionName' =>
'SomeExtension',
277 'requestHandlers' => array(
278 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' =>
'SomeRequestHandler' 282 $expectedResult = $frameworkConfiguration;
283 $actualResult = $this->backendConfigurationManager->_call(
'getContextSpecificFrameworkConfiguration', $frameworkConfiguration);
284 $this->assertEquals($expectedResult, $actualResult);
291 $frameworkConfiguration = array(
292 'pluginName' =>
'Pi1',
293 'extensionName' =>
'SomeExtension',
300 $expectedResult = array(
301 'pluginName' =>
'Pi1',
302 'extensionName' =>
'SomeExtension',
309 'requestHandlers' => array(
310 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' =>
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler',
311 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\BackendRequestHandler' =>
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\BackendRequestHandler' 315 $actualResult = $this->backendConfigurationManager->_call(
'getContextSpecificFrameworkConfiguration', $frameworkConfiguration);
316 $this->assertEquals($expectedResult, $actualResult);
322 public function storagePidsAreExtendedIfRecursiveSearchIsConfigured() {
323 $storagePid =
'1,2,3';
326 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
327 $queryGenerator = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\QueryGenerator');
328 $queryGenerator->expects($this->any())
329 ->method(
'getTreeList')
330 ->will($this->onConsecutiveCalls(
'4',
'',
'5,6'));
331 $abstractConfigurationManager->_set(
'queryGenerator', $queryGenerator);
333 $expectedResult =
'4,5,6';
334 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid, $recursive);
335 $this->assertEquals($expectedResult, $actualResult);
341 public function storagePidsAreExtendedIfRecursiveSearchIsConfiguredAndWithPidIncludedForNegativePid() {
342 $storagePid =
'1,2,-3';
345 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
346 $queryGenerator = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\QueryGenerator');
347 $queryGenerator->expects($this->any())
348 ->method(
'getTreeList')
349 ->will($this->onConsecutiveCalls(
'4',
'',
'3,5,6'));
350 $abstractConfigurationManager->_set(
'queryGenerator', $queryGenerator);
352 $expectedResult =
'4,3,5,6';
353 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid, $recursive);
354 $this->assertEquals($expectedResult, $actualResult);
361 $storagePid =
'1,2,3';
363 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
365 $queryGenerator = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\QueryGenerator');
366 $queryGenerator->expects($this->never())->method(
'getTreeList');
367 $abstractConfigurationManager->_set(
'queryGenerator', $queryGenerator);
369 $expectedResult =
'1,2,3';
370 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid);
371 $this->assertEquals($expectedResult, $actualResult);
378 $storagePid =
'1,2,3';
381 $abstractConfigurationManager = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array(
'overrideSwitchableControllerActions',
'getContextSpecificFrameworkConfiguration',
'getTypoScriptSetup',
'getPluginConfiguration',
'getSwitchableControllerActions'));
383 $queryGenerator = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\QueryGenerator');
384 $queryGenerator->expects($this->never())->method(
'getTreeList');
385 $abstractConfigurationManager->_set(
'queryGenerator', $queryGenerator);
387 $expectedResult =
'1,2,3';
388 $actualResult = $abstractConfigurationManager->_call(
'getRecursiveStoragePids', $storagePid, $recursive);
389 $this->assertEquals($expectedResult, $actualResult);
storagePidsAreNotExtendedIfRecursiveSearchIsNotConfigured()
getPluginConfigurationReturnsExtensionConfiguration()
getSwitchableControllerActionsReturnsConfigurationStoredInExtconf()
getCurrentPageIdReturnsDefaultStoragePidIfIdIsNotSetNoRootTemplateAndRootPageWasFound()
getCurrentPageIdReturnsUidFromFirstRootPageIfIdIsNotSet()
getCurrentPageIdReturnsPageIdFromGet()
getCurrentPageIdReturnsPidFromFirstRootTemplateIfIdIsNotSetAndNoRootPageWasFound()
getContextSpecificFrameworkConfigurationSetsDefaultRequestHandlersIfRequestHandlersAreNotConfigured()
getPluginConfigurationReturnsEmptyArrayIfNoPluginConfigurationWasFound()
storagePidsAreNotExtendedIfRecursiveSearchIsConfiguredForZeroLevels()
$backendConfigurationManager
getSwitchableControllerActionsReturnsEmptyArrayByDefault()
static _GETset($inputGet, $key='')
getCurrentPageIdReturnsPageIdFromPost()
const DEFAULT_BACKEND_STORAGE_PID
getPluginConfigurationReturnsPluginConfiguration()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
getPluginConfigurationRecursivelyMergesExtensionAndPluginConfiguration()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
getContextSpecificFrameworkConfigurationReturnsUnmodifiedFrameworkConfigurationIfRequestHandlersAreConfigured()