I have a temporary signed route to change the email of an user. Now I want to test this route with PHPUnit. But when I try to get the route, I get an "403 Error" (of course).
Is there any smart way to solve this, or do I have to create a new signed route manually and use this for my get request?
Hi! If you are trying to test another aspect of that route and want to have a signed in user to pass the auth part, then just make up a regular signed in user (or use create if you want to persist it) before your get to the request line.
$this->actingAs(factory(User::class)->make());
Don't forget to import User (use App\User;) at the top, or replace User::class with 'App\User'.
My mistake. In that case maybe you could try the hasValidSignature() method along with the request in the test? Validating Signed Route Requests section here:
https://laravel.com/docs/6.x/urls#signed-urls