mirror of
https://gh.wpcy.net/https://github.com/fairpm/aspirecloud.git
synced 2026-06-19 02:13:44 +08:00
33 lines
764 B
PHP
33 lines
764 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\User;
|
|
|
|
test('login screen can be rendered', function () {
|
|
$response = $this->get('/login');
|
|
|
|
$response->assertStatus(200);
|
|
});
|
|
|
|
test('users can authenticate using the login screen', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->post('/login', [
|
|
'email' => $user->email,
|
|
'password' => 'password',
|
|
]);
|
|
|
|
$this->assertAuthenticated();
|
|
$response->assertRedirect(route('dashboard', absolute: false));
|
|
});
|
|
|
|
test('users cannot authenticate with invalid password', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$this->post('/login', [
|
|
'email' => $user->email,
|
|
'password' => 'wrong-password',
|
|
]);
|
|
|
|
$this->assertGuest();
|
|
});
|