DEF STUDIO srl

Need help with Laravel and web development?

Hire one of our experts for your projects.

We build tailored products, websites and platforms — with care for UX, performance and maintainability.

Booking open for Q4 — limited slots

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' => '[email protected]', 'password' => 'wrongpassword'])->toBeInvalidCredentials();

toBeValidCredentials()

Assert that the given credentials are valid.

expect(['email' => '[email protected]', 'password' => 'foo'])->toBeValidCredentials();
Suggest a change
Last updated 22 August 2025