58 $this->requestBuilder = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\RequestBuilder', array(
'dummy'));
59 $this->configuration = array(
60 'userFunc' =>
'Tx_Extbase_Dispatcher->dispatch',
61 'pluginName' =>
'Pi1',
62 'extensionName' =>
'MyExtension',
63 'controller' =>
'TheFirstController',
65 'controllerConfiguration' => array(
66 'TheFirstController' => array(
67 'actions' => array(
'show',
'index',
'new',
'create',
'delete',
'edit',
'update',
'setup',
'test')
69 'TheSecondController' => array(
70 'actions' => array(
'show',
'index')
72 'TheThirdController' => array(
73 'actions' => array(
'delete',
'create',
'onlyInThirdController')
77 $this->mockConfigurationManager = $this->getMock(
'TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
78 $this->mockRequest = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
79 $this->mockObjectManager = $this->getMock(
'TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
80 $this->mockExtensionService = $this->getMock(
'TYPO3\\CMS\\Extbase\\Service\\ExtensionService');
81 $this->mockEnvironmentService = $this->getMock(
'TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array(
'getServerRequestMethod'));
88 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
89 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
90 $this->mockObjectManager->expects($this->any())->method(
'get')->with(
'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request')->will($this->returnValue($this->mockRequest));
91 $this->requestBuilder->_set(
'objectManager', $this->mockObjectManager);
92 $pluginNamespace =
'tx_' . strtolower(($this->configuration[
'extensionName'] .
'_' . $this->configuration[
'pluginName']));
93 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue($pluginNamespace));
94 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
95 $this->mockEnvironmentService->expects($this->any())->method(
'getServerRequestMethod')->will($this->returnValue(
'GET'));
96 $this->requestBuilder->_set(
'environmentService', $this->mockEnvironmentService);
104 $request = $this->requestBuilder->build();
105 $this->assertSame($this->mockRequest, $request);
113 $this->mockRequest->expects($this->once())->method(
'setPluginName')->with(
'Pi1');
114 $this->requestBuilder->build();
122 $this->mockRequest->expects($this->once())->method(
'setControllerExtensionName')->with(
'MyExtension');
123 $this->requestBuilder->build();
131 $this->mockRequest->expects($this->once())->method(
'setControllerName')->with(
'TheFirstController');
132 $this->requestBuilder->build();
140 $this->mockRequest->expects($this->once())->method(
'setControllerActionName')->with(
'show');
141 $this->requestBuilder->build();
150 $this->mockRequest->expects($this->once())->method(
'setRequestUri')->with($expectedRequestUri);
151 $this->requestBuilder->build();
160 $this->mockRequest->expects($this->once())->method(
'setBaseUri')->with($expectedBaseUri);
161 $this->requestBuilder->build();
169 $expectedMethod =
'SomeRequestMethod';
170 $mockEnvironmentService = $this->getMock(
'TYPO3\\CMS\\Extbase\\Service\\EnvironmentService', array(
'getServerRequestMethod'));
171 $mockEnvironmentService->expects($this->once())->method(
'getServerRequestMethod')->will($this->returnValue($expectedMethod));
173 $this->mockRequest->expects($this->once())->method(
'setMethod')->with($expectedMethod);
174 $this->requestBuilder->build();
182 $expectedVendor =
'Vendor';
183 $this->configuration[
'vendorName'] = $expectedVendor;
185 $mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
187 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
188 $this->mockRequest->expects($this->once())->method(
'setControllerVendorName')->with($expectedVendor);
189 $this->requestBuilder->build();
197 $expectedVendor =
'Vendor';
198 $this->configuration[
'vendorName'] = $expectedVendor;
201 $mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
203 $this->mockRequest->expects($this->once())->method(
'setControllerVendorName')->with($expectedVendor);
205 $this->requestBuilder->build();
207 unset($this->configuration[
'vendorName']);
209 $mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
212 $this->mockRequest->expects($this->never())->method(
'setControllerVendorName');
213 $this->requestBuilder->build();
221 unset($this->configuration[
'extensionName']);
223 $mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
225 $this->requestBuilder->build();
233 unset($this->configuration[
'pluginName']);
235 $mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
237 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
238 $this->requestBuilder->build();
246 $this->configuration[
'controllerConfiguration'] = array();
247 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
248 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
249 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
250 $this->requestBuilder->build();
258 $this->configuration[
'controllerConfiguration'][
'TheFirstController'] = array();
259 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
260 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
261 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
262 $this->requestBuilder->build();
270 $this->configuration[
'controllerConfiguration'] = array(
272 'actions' => array(
'foo')
275 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
276 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
277 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
278 $this->requestBuilder->build();
285 $this->configuration[
'extensionName'] =
'SomeExtensionName';
286 $this->configuration[
'pluginName'] =
'SomePluginName';
289 'tx_someotherextensionname_somepluginname' => array(
292 'tx_someextensionname_somepluginname' => array(
293 'parameter1' =>
'valueGetsOverwritten',
294 'parameter2' => array(
295 'parameter3' =>
'value3' 300 'tx_someextensionname_someotherpluginname' => array(
303 'tx_someextensionname_somepluginname' => array(
304 'parameter1' =>
'value1',
305 'parameter2' => array(
306 'parameter4' =>
'value4' 310 $this->mockRequest->expects($this->at(8))->method(
'setArgument')->with(
'parameter1',
'value1');
311 $this->mockRequest->expects($this->at(9))->method(
'setArgument')->with(
'parameter2', array(
'parameter3' =>
'value3',
'parameter4' =>
'value4'));
312 $this->requestBuilder->build();
319 $this->configuration[
'extensionName'] =
'SomeExtensionName';
320 $this->configuration[
'pluginName'] =
'SomePluginName';
323 'tx_someextensionname_somepluginname' => array(
328 'tx_someextensionname_somepluginname' => array(
332 $this->mockRequest->expects($this->at(7))->method(
'setFormat')->with(
'POST');
333 $this->requestBuilder->build();
341 $expectedResult = array(
342 'TheFirstController' => array(
353 'TheSecondController' => array(
357 'TheThirdController' => array(
360 'onlyInThirdController' 363 $this->requestBuilder->build();
364 $actualResult = $this->requestBuilder->_get(
'allowedControllerActions');
365 $this->assertEquals($expectedResult, $actualResult);
373 $this->configuration[
'controllerConfiguration'] = array();
374 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
375 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
376 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue(
'tx_myextension_pi1'));
377 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
378 $this->requestBuilder->build();
387 'tx_myextension_pi1' => array(
391 $this->mockRequest->expects($this->once())->method(
'setControllerName')->with(
'TheFirstController');
392 $this->requestBuilder->build();
401 'tx_myextension_pi1' => array(
402 'controller' =>
'TheSecondController' 405 $this->mockRequest->expects($this->once())->method(
'setControllerName')->with(
'TheSecondController');
406 $this->requestBuilder->build();
414 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
415 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
416 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue(
'tx_myextension_pi1'));
417 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
419 'tx_myextension_pi1' => array(
420 'controller' =>
'SomeInvalidController' 423 $this->requestBuilder->build();
431 $this->configuration[
'mvc'][
'throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
432 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
433 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
434 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue(
'tx_myextension_pi1'));
435 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
437 'tx_myextension_pi1' => array(
438 'controller' =>
'SomeInvalidController' 441 $this->requestBuilder->build();
448 $this->configuration[
'mvc'][
'callDefaultActionIfActionCantBeResolved'] = 1;
450 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
452 'tx_myextension_pi1' => array(
453 'controller' =>
'SomeInvalidController' 456 $this->mockRequest->expects($this->once())->method(
'setControllerName')->with(
'TheFirstController');
457 $this->requestBuilder->build();
465 $this->configuration[
'controllerConfiguration'] = array();
466 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
467 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
468 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue(
'tx_myextension_pi1'));
469 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
470 $this->requestBuilder->build();
479 'tx_myextension_pi1' => array(
480 'controller' =>
'TheThirdController' 483 $this->mockRequest->expects($this->once())->method(
'setControllerActionName')->with(
'delete');
484 $this->requestBuilder->build();
493 'tx_myextension_pi1' => array(
497 $this->mockRequest->expects($this->once())->method(
'setControllerActionName')->with(
'create');
498 $this->requestBuilder->build();
507 'tx_myextension_pi1' => array(
508 'controller' =>
'TheThirdController',
509 'action' =>
'onlyInThirdController' 512 $this->mockRequest->expects($this->once())->method(
'setControllerActionName')->with(
'onlyInThirdController');
513 $this->requestBuilder->build();
521 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
522 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
523 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue(
'tx_myextension_pi1'));
524 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
526 'tx_myextension_pi1' => array(
527 'action' =>
'someInvalidAction' 530 $this->requestBuilder->build();
538 $this->configuration[
'mvc'][
'throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
539 $this->mockConfigurationManager->expects($this->any())->method(
'getConfiguration')->will($this->returnValue($this->configuration));
540 $this->requestBuilder->_set(
'configurationManager', $this->mockConfigurationManager);
541 $this->mockExtensionService->expects($this->any())->method(
'getPluginNamespace')->will($this->returnValue(
'tx_myextension_pi1'));
542 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
544 'tx_myextension_pi1' => array(
545 'action' =>
'someInvalidAction' 548 $this->requestBuilder->build();
555 $this->configuration[
'mvc'][
'callDefaultActionIfActionCantBeResolved'] = 1;
557 $this->requestBuilder->_set(
'extensionService', $this->mockExtensionService);
559 'tx_myextension_pi1' => array(
560 'controller' =>
'TheThirdController',
561 'action' =>
'someInvalidAction' 564 $this->mockRequest->expects($this->once())->method(
'setControllerName')->with(
'TheThirdController');
565 $this->mockRequest->expects($this->once())->method(
'setControllerActionName')->with(
'delete');
566 $this->requestBuilder->build();
574 $convolutedFiles = array(
583 'a1' =>
'/private/var/tmp/phpbqXsYt' 600 'b1' =>
'/private/var/tmp/phpvZ6oUD' 611 'type' =>
'text/plain',
612 'tmp_name' =>
'/private/var/tmp/phpS9KMNw',
634 'd3' =>
'/private/var/tmp/phprR3fax' 673 0 =>
'/private/var/tmp/php01fitB',
674 1 =>
'/private/var/tmp/phpUUB2cv' 696 $untangledFiles = array(
700 'type' =>
'text/plain',
701 'tmp_name' =>
'/private/var/tmp/phpbqXsYt',
709 'type' =>
'text/plain',
710 'tmp_name' =>
'/private/var/tmp/phpvZ6oUD',
717 'type' =>
'text/plain',
718 'tmp_name' =>
'/private/var/tmp/phpS9KMNw',
727 'type' =>
'text/plain',
728 'tmp_name' =>
'/private/var/tmp/phprR3fax',
739 'name' =>
'e_one.txt',
740 'type' =>
'text/plain',
741 'tmp_name' =>
'/private/var/tmp/php01fitB',
746 'name' =>
'e_two.txt',
747 'type' =>
'text/plain',
748 'tmp_name' =>
'/private/var/tmp/phpUUB2cv',
758 $this->assertSame($untangledFiles,
$result);
buildCorrectlySetsSpecifiedControllerNameIfItsAllowedForTheCurrentPlugin()
buildSetsRequestControllerActionName()
buildSetsRequestPluginName()
buildSetsRequestControllerName()
buildSetsDefaultControllerIfNoControllerIsSpecified()
buildCorrectlySetsSpecifiedActionNameForTheSpecifiedControllerIfItsAllowedForTheCurrentPlugin()
buildSetsRequestControllerExtensionName()
buildSetsDefaultActionOfTheCurrentControllerIfNoActionIsSpecified()
buildThrowsExceptionIfPluginNameIsNotConfigured()
buildThrowsExceptionIfDefaultControllerCantBeDetermined()
static getIndpEnv($getEnvName)
buildSetsParametersFromGetAndPostVariables()
buildThrowsExceptionIfNoDefaultControllerCanBeResolved()
buildThrowsExceptionIfControllerConfigurationIsEmptyOrNotSet()
buildSetsRequestRequestUri()
buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedActionIsNotAllowed()
buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedControllerIsNotAllowed()
buildThrowsInvalidControllerNameExceptionIfSpecifiedControllerIsNotAllowed()
buildThrowsInvalidActionNameExceptionIfSpecifiedActionIsNotAllowed()
buildThrowsExceptionIfExtensionNameIsNotConfigured()
buildThrowsExceptionIfControllerConfigurationHasNoDefaultActionDefined()
untangleFilesArrayTransformsTheFilesSuperglobalIntoAManageableForm()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
buildThrowsExceptionIfDefaultActionCantBeDetermined()
buildSetsDefaultControllerNameIfSpecifiedControllerIsNotAllowedAndCallDefaultActionIfActionCantBeResolvedIsSet()
buildSetsDefaultActionNameIfSpecifiedActionIsNotAllowedAndCallDefaultActionIfActionCantBeResolvedIsSet()
buildReturnsAWebRequestObject()
buildSetsVendorNameIfConfigured()
buildCorrectlySetsAllowedControllerActions()
buildCorrectlySetsSpecifiedActionNameForTheDefaultControllerIfItsAllowedForTheCurrentPlugin()
$mockConfigurationManager
buildSetsFormatFromGetAndPostVariables()
buildDoesNotSetVendorNameIfNotConfiguredInSecondRequest()
buildSetsRequestBaseUri()