public function mapRequestArgumentsToControllerArgumentsDoesJustThat()
{
$mockPropertyMapper = $this->getMockBuilder(PropertyMapper::class)->disableOriginalConstructor()->setMethods(['convert'])->getMock();
$mockPropertyMapper->expects($this->atLeastOnce())->method('convert')->will($this->returnArgument(0));
$controllerArguments = new Arguments();
$controllerArguments->addNewArgument('foo', 'string', true);
$controllerArguments->addNewArgument('baz', 'string', true);
foreach ($controllerArguments as $controllerArgument) {
$this->inject($controllerArgument, 'propertyMapper', $mockPropertyMapper);
}
$controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']);
$controller->_call('initializeController', $this->mockActionRequest, $this->mockHttpResponse);
$controller->_set('arguments', $controllerArguments);
$this->mockActionRequest->expects($this->at(0))->method('hasArgument')->with('foo')->will($this->returnValue(true));
$this->mockActionRequest->expects($this->at(1))->method('getArgument')->with('foo')->will($this->returnValue('bar'));
$this->mockActionRequest->expects($this->at(2))->method('hasArgument')->with('baz')->will($this->returnValue(true));
$this->mockActionRequest->expects($this->at(3))->method('getArgument')->with('baz')->will($this->returnValue('quux'));
$controller->_call('mapRequestArgumentsToControllerArguments');
$this->assertEquals('bar', $controllerArguments['foo']->getValue());
$this->assertEquals('quux', $controllerArguments['baz']->getValue());
}