/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function setDefaultValueReallySetsDefaultValue() { $argument = new \F3\FLOW3\MVC\Controller\Argument('dummy', 'Text'); $argument->injectObjectFactory($this->mockObjectFactory); $argument->setDefaultValue(42); $this->assertEquals(42, $argument->getValue(), 'The default value was not stored in the Argument.'); }
/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function callActionMethodPassesDefaultValuesAsArguments() { $mockRequest = $this->getMock('F3\\FLOW3\\MVC\\RequestInterface', array(), array(), '', FALSE); $mockResponse = $this->getMock('F3\\FLOW3\\MVC\\ResponseInterface', array(), array(), '', FALSE); $arguments = new \ArrayObject(); $optionalArgument = new \F3\FLOW3\MVC\Controller\Argument('name1', 'Text'); $optionalArgument->setDefaultValue('Default value'); $arguments[] = $optionalArgument; $mockArgumentMappingResults = $this->getMock('F3\\FLOW3\\Property\\MappingResults', array(), array(), '', FALSE); $mockArgumentMappingResults->expects($this->once())->method('hasErrors')->will($this->returnValue(FALSE)); $mockController = $this->getMock($this->buildAccessibleProxy('F3\\FLOW3\\MVC\\Controller\\ActionController'), array('fooAction', 'initializeAction'), array(), '', FALSE); $mockController->expects($this->once())->method('fooAction')->with('Default value'); $mockController->_set('request', $mockRequest); $mockController->_set('response', $mockResponse); $mockController->_set('arguments', $arguments); $mockController->_set('actionMethodName', 'fooAction'); $mockController->_set('argumentsMappingResults', $mockArgumentMappingResults); $mockController->_call('callActionMethod'); }