Files
animethemes-server/tests/Feature/Actions/Fortify/AuthenticationTest.php
T
paranarimasu 3ed878ab46 fix: allow configurable domain and prefix for all supported routes (#393)
* fix: allow configurable domain and prefix for all supported routes

* style: fix StyleCI finding
2022-06-07 09:56:46 -05:00

63 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature\Actions\Fortify;
use App\Models\Auth\User;
use App\Providers\RouteServiceProvider;
use Tests\TestCase;
/**
* Class AuthenticationTest.
*/
class AuthenticationTest extends TestCase
{
/**
* Login screen can be rendered.
*
* @return void
*/
public function testLoginScreenCanBeRendered(): void
{
$response = $this->get(route('login'));
$response->assertStatus(200);
}
/**
* Users can authenticate using the login screen.
*
* @return void
*/
public function testUsersCanAuthenticateUsingTheLoginScreen(): void
{
$user = User::factory()->createOne();
$response = $this->post(route('login'), [
'email' => $user->email,
'password' => 'password',
]);
$this->assertAuthenticated();
$response->assertRedirect(RouteServiceProvider::HOME);
}
/**
* Users cannot authenticate with invalid password.
*
* @return void
*/
public function testUsersCanNotAuthenticateWithInvalidPassword(): void
{
$user = User::factory()->createOne();
$this->post(route('login'), [
'email' => $user->email,
'password' => 'wrong-password',
]);
$this->assertGuest();
}
}