$resolver =
new RequestPayloadValueResolver( new Serializer(),
$this->
createMock(ValidatorInterface::
class),
);
$argument =
new ArgumentMetadata('notTyped', null, false, false, null, false,
[ MapRequestPayload::
class => new MapRequestPayload(),
]);
$request = Request::
create('/', 'POST', server:
['HTTP_CONTENT_TYPE' => 'application/json'
]);
$kernel =
$this->
createMock(HttpKernelInterface::
class);
$arguments =
$resolver->
resolve($request,
$argument);
$event =
new ControllerArgumentsEvent($kernel,
function D
) {},
$arguments,
$request, HttpKernelInterface::MAIN_REQUEST
);
$this->
expectException(\LogicException::
class);
$this->
expectExceptionMessage('Could not resolve the "$notTyped" controller argument: argument should be typed.'
);
$resolver->
onKernelControllerArguments($event);
} public function testDefaultValueArgument() { $payload =
new RequestPayload(50
);