New assertion: $response->assertRedirectRoute() #39423
Replies: 1 comment
-
This is already implemented in latest version |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Would a PR be welcomed that adds a new method to
\Illuminate\Testing\TestResponse
that asserts the response is a redirect to a particular named route? Something along the lines of:Other possible methods names could be
assertRedirectToRoute()
or maybeassertRedirectRouteIs()
?One particular use case for me is as follows:
I'm using "action" classes for my business logic, which are tested separately from my HTTP requests.
In my HTTP resets I'm mocking the use of my action classes, in the cases where my actions return a model, the mock returns a model instance created by a factory.
In some of my HTTP tests, I want to assert the response is a redirect to a particular route. I can't easily pass in a URL to
assertRedirect()
as many of the routes use route model binding and I won't know the ID or slug of the model returned by the mock as they're randomly generated in the model factory.Beta Was this translation helpful? Give feedback.
All reactions