reinstalled

This commit is contained in:
2025-05-06 23:15:56 +05:45
parent 96e5efeb1b
commit 9392d34c76
66 changed files with 2145 additions and 1096 deletions

View File

@ -1,54 +1,41 @@
<?php
namespace Tests\Feature\Auth;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AuthenticationTest extends TestCase
{
use RefreshDatabase;
test('login screen can be rendered', function () {
$response = $this->get('/login');
public function test_login_screen_can_be_rendered(): void
{
$response = $this->get('/login');
$response->assertStatus(200);
});
$response->assertStatus(200);
}
test('users can authenticate using the login screen', function () {
$user = User::factory()->create();
public function test_users_can_authenticate_using_the_login_screen(): void
{
$user = User::factory()->create();
$response = $this->post('/login', [
'email' => $user->email,
'password' => 'password',
]);
$response = $this->post('/login', [
'email' => $user->email,
'password' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(route('dashboard', absolute: false));
});
$this->assertAuthenticated();
$response->assertRedirect(route('dashboard', absolute: false));
}
test('users can not authenticate with invalid password', function () {
$user = User::factory()->create();
public function test_users_can_not_authenticate_with_invalid_password(): void
{
$user = User::factory()->create();
$this->post('/login', [
'email' => $user->email,
'password' => 'wrong-password',
]);
$this->post('/login', [
'email' => $user->email,
'password' => 'wrong-password',
]);
$this->assertGuest();
});
$this->assertGuest();
}
test('users can logout', function () {
$user = User::factory()->create();
public function test_users_can_logout(): void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/logout');
$response = $this->actingAs($user)->post('/logout');
$this->assertGuest();
$response->assertRedirect('/');
}
}
$this->assertGuest();
$response->assertRedirect('/');
});