public function forwardResetsControllerArguments()
{
$mockPersistenceManager = $this->createMock(PersistenceManagerInterface::class);
$mockPersistenceManager->expects($this->any())->method('convertObjectsToIdentityArrays')->will($this->returnArgument(0));
$controller = $this->getAccessibleMock(AbstractController::class, ['processRequest']);
$this->inject($controller, 'persistenceManager', $mockPersistenceManager);
$controller->_call('initializeController', $this->mockActionRequest, $this->mockHttpResponse);
try {
$controller->_call('forward', 'theTarget', 'Bar', 'MyPackage', ['foo' => 'bar']);
} catch (ForwardException $exception) {
}
if (!isset($exception)) {
$this->fail('ForwardException was not thrown after calling forward()');
}
// all arguments of the current controller must be reset, in case the controller is called again later:
$arguments = $controller->_get('arguments');
$this->assertFalse($arguments->hasArgument('foo'));
}