JFIF x x C C " } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w !1AQ aq"2B #3Rbr{
File "AuthenticationTest.php"
Full Path: /var/www/laravel_filter/vendor/laravel/breeze/stubs/livewire-common/pest-tests/Feature/Auth/AuthenticationTest.php
File size: 1.58 KB
MIME-type: text/x-php
Charset: utf-8
<?php
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Livewire\Volt\Volt;
test('login screen can be rendered', function () {
$response = $this->get('/login');
$response
->assertOk()
->assertSeeVolt('pages.auth.login');
});
test('users can authenticate using the login screen', function () {
$user = User::factory()->create();
$component = Volt::test('pages.auth.login')
->set('form.email', $user->email)
->set('form.password', 'password');
$component->call('login');
$component
->assertHasNoErrors()
->assertRedirect(RouteServiceProvider::HOME);
$this->assertAuthenticated();
});
test('users can not authenticate with invalid password', function () {
$user = User::factory()->create();
$component = Volt::test('pages.auth.login')
->set('form.email', $user->email)
->set('form.password', 'wrong-password');
$component->call('login');
$component
->assertHasErrors()
->assertNoRedirect();
$this->assertGuest();
});
test('navigation menu can be rendered', function () {
$user = User::factory()->create();
$this->actingAs($user);
$response = $this->get('/dashboard');
$response
->assertOk()
->assertSeeVolt('layout.navigation');
});
test('users can logout', function () {
$user = User::factory()->create();
$this->actingAs($user);
$component = Volt::test('layout.navigation');
$component->call('logout');
$component
->assertHasNoErrors()
->assertRedirect('/');
$this->assertGuest();
});