Created
May 16, 2011 08:28
-
-
Save skurfuerst/974095 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* @test | |
* @author Bastian Waidelich <[email protected]> | |
*/ | |
public function packageKeyCanBeOverwrittenByRequest() { | |
$packageKey = NULL; | |
$setControllerPackageKeyCallback = function() use (&$packageKey) { | |
$args = func_get_args(); | |
$packageKey = $args[0]; | |
}; | |
$router = $this->getRouter(); | |
$router->expects($this->once())->method('findMatchResults')->with('foo')->will($this->returnValue(array('@package' => 'MyPackage'))); | |
$mockRequest = $this->getMock('F3\FLOW3\MVC\Web\Request', array(), array(), '', FALSE); | |
$mockRequest->expects($this->once())->method('getRoutePath')->will($this->returnValue('foo')); | |
$mockRequest->expects($this->any())->method('getArguments')->will($this->returnValue(array('@package' => 'OverwrittenPackage'))); | |
$mockRequest->expects($this->exactly(2))->method('setControllerPackageKey')->will($this->returnCallback($setControllerPackageKeyCallback)); | |
$router->route($mockRequest); | |
$this->assertEquals('OverwrittenPackage', $packageKey); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment