In phpunit, how can I check the destination url for my validation failed redirect? (Laravel, PHP)

My form validation is failing and I'm getting redirected back with error messages. In phpunit, how can I check the destination url for my validation failed redirect?
When I try to check $response redirect url like so
$response->assertRedirect($url);
I'm getting error:
Response status code [422] is not a redirect status code.
Here an example of how the redirect url can be set
use Illuminate\Validation\ValidationException;
$validationException = new ValidationException($validator);
$validationException->redirectTo($redirectUrl);
How can it be tested?
Answer
Solution:
I was using
$response = $this->json('POST', $route, [...
instead of
$response = $this->post($route, [...
once I switched topost
the function
$response->assertLocation($url);
started working.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: http failure during parsing for
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.