/** * @test * @expectedException \TYPO3\CMS\Core\Error\Http\PageNotFoundException */ public function buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedActionIsNotAllowed() { $this->configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved'] = 1; $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration)); $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager); $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1')); $this->requestBuilder->_set('extensionService', $this->mockExtensionService); $_GET = array('tx_myextension_pi1' => array('action' => 'someInvalidAction')); $this->requestBuilder->build(); }
/** * @test */ public function removeDefaultControllerAndActionRemovesControllerAndActionIfBothAreEqualToTheDefault() { $this->mockExtensionService->expects($this->atLeastOnce())->method('getDefaultControllerNameByPlugin')->with('ExtensionName', 'PluginName')->will($this->returnValue('DefaultController')); $this->mockExtensionService->expects($this->atLeastOnce())->method('getDefaultActionNameByPluginAndController')->with('ExtensionName', 'PluginName', 'DefaultController')->will($this->returnValue('defaultAction')); $arguments = array('controller' => 'DefaultController', 'action' => 'defaultAction', 'foo' => 'bar'); $extensionName = 'ExtensionName'; $pluginName = 'PluginName'; $expectedResult = array('foo' => 'bar'); $actualResult = $this->uriBuilder->_callRef('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName); $this->assertEquals($expectedResult, $actualResult); }
/** * @test */ public function renderAddsDefaultFieldNamePrefixToTemplateVariableContainerIfNoPrefixIsSpecified() { $expectedPrefix = 'tx_someextension_someplugin'; $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::class, array('renderChildren', 'renderHiddenIdentityField', 'renderHiddenReferrerFields', 'renderRequestHashField', 'addFormFieldNamesToViewHelperVariableContainer', 'removeFormFieldNamesFromViewHelperVariableContainer', 'renderTrustedPropertiesField'), array(), '', false); $this->mockExtensionService->expects($this->once())->method('getPluginNamespace')->with('SomeExtension', 'SomePlugin')->will($this->returnValue('tx_someextension_someplugin')); $viewHelper->_set('extensionService', $this->mockExtensionService); $this->injectDependenciesIntoViewHelper($viewHelper); $viewHelper->setArguments(array('extensionName' => 'SomeExtension', 'pluginName' => 'SomePlugin')); $this->viewHelperVariableContainer->expects($this->once())->method('add')->with(\TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::class, 'fieldNamePrefix', $expectedPrefix); $this->viewHelperVariableContainer->expects($this->once())->method('remove')->with(\TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper::class, 'fieldNamePrefix'); $viewHelper->render(); }