Authentication Expectations

toBeAuthenticated()

Assert that the given User is authenticated.

expect($user)->toBeAuthenticated();

toBeValidCredentials()

Assert that the given credentials are valid.

expect(['email' => 'test@email.it', 'password' => 'foo'])->toBeValidCredentials();

toBeInvalidCredentials()

Assert that the given credentials are invalid.

expect(['email' => 'test@email.it', 'password' => 'wrongpassword'])->toBeInvalidCredentials();

toBeAbleTo()

Assert that the given User is authorized to do something.

expect($user)->toBeAbleTo('edit', $post);
Edit this page on GitHub Updated at Fri, Oct 15, 2021