Authentication Expectations

toBeAbleTo()

Assert that the given User is authorized to do something.

expect($user)->toBeAbleTo('edit', $post);

toBeAuthenticated()

Assert that the given User is authenticated.

expect($user)->toBeAuthenticated();

toBeInvalidCredentials()

Assert that the given credentials are invalid.

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

toBeValidCredentials()

Assert that the given credentials are valid.

expect(['email' => 'test@email.it', 'password' => 'foo'])->toBeValidCredentials();
Edit this page on GitHub Updated at Wed, Feb 8, 2023