Created
December 1, 2011 12:24
-
-
Save radmiraal/1416348 to your computer and use it in GitHub Desktop.
Plugin unit test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @test | |
*/ | |
public function renderSetsControllerActionInformationOnRequestObjectIfThePluginHasNoNode() { | |
$plugin = $this->getAccessibleMock('TYPO3\TYPO3\TypoScript\Plugin', array('getPluginNamespace')); | |
$plugin->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('typo3_plugin_namespace')); | |
$plugin->setRenderingContext($this->mockRenderingContext); | |
$plugin->_set('subRequestBuilder', $this->mockSubRequestBuilder); | |
$plugin->_set('objectManager', $this->mockObjectManager); | |
$plugin->_set('dispatcher', $this->mockDispatcher); | |
$plugin->setPackage('SomePackageKey'); | |
$plugin->setSubpackage('SomeSubpackageKey'); | |
$plugin->setController('SomeController'); | |
$plugin->setAction('someAction'); | |
$mockPluginRequest = $this->getMock('TYPO3\FLOW3\MVC\Web\SubRequest', array(), array(), '', FALSE); | |
$mockPluginRequest->expects($this->any())->method('getControllerPackageKey')->will($this->returnValue('SomePackageKey')); | |
$mockPluginRequest->expects($this->any())->method('getControllerSubpackageKey')->will($this->returnValue('SomeSubpackageKey')); | |
$mockPluginRequest->expects($this->any())->method('getControllerName')->will($this->returnValue('SomeController')); | |
$mockPluginRequest->expects($this->any())->method('getControllerActionName')->will($this->returnValue('someAction')); | |
$this->mockSubRequestBuilder->expects($this->once())->method('build')->with($this->mockRequest, 'typo3_plugin_namespace')->will($this->returnValue($mockPluginRequest)); | |
$pluginRequest = $plugin->_call('buildPluginRequest'); | |
$this->assertEquals('SomePackageKey', $pluginRequest->getControllerPackageKey()); | |
$this->assertEquals('SomeSubpackageKey', $pluginRequest->getControllerSubpackageKey()); | |
$this->assertEquals('SomeController', $pluginRequest->getControllerName()); | |
$this->assertEquals('someAction', $pluginRequest->getControllerActionName()); | |
$plugin->render(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment