Laravel 5 testing routes

91 Views Asked by At

I want to test my named routes redirect to the URL they are supposed to. For example:

get('users/profile', ['uses' => 'UserController@profile', 'as' => 'users.profile']);

How can I assert that users.profile is indeed redirecting to users/profile and that the called method is indeed UserController#profile() ?

1

There are 1 best solutions below

0
On

If I'm not mistaken, you could use the Request class and call the Request::is('users/profile') if you use the facade in your unit test. Otherwise, either instantiate the Request class or call the Facade directly.

Not sure this is what you're looking for, but that's my best shot.