Move auth controller tests to namespace and refactor

This commit is contained in:
Christopher C. Wells 2021-03-29 19:55:06 -07:00 committed by Christopher Charbonneau Wells
parent cae56df555
commit 9571454175
4 changed files with 17 additions and 17 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Tests\Feature; namespace Tests\Feature\Http\Controllers\Auth;
use App\Models\User; use App\Models\User;
use App\Providers\RouteServiceProvider; use App\Providers\RouteServiceProvider;
@ -11,14 +11,14 @@ class AuthenticationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_login_screen_can_be_rendered() public function testLoginScreenCanRendered()
{ {
$response = $this->get('/login'); $response = $this->get('/login');
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_users_can_authenticate_using_the_login_screen() public function testUsersCanAuthenticateUsingLoginScreen()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -31,7 +31,7 @@ class AuthenticationTest extends TestCase
$response->assertRedirect(RouteServiceProvider::HOME); $response->assertRedirect(RouteServiceProvider::HOME);
} }
public function test_users_can_not_authenticate_with_invalid_password() public function testUsersCannotAuthenticateWithInvalidPassword()
{ {
$user = User::factory()->create(); $user = User::factory()->create();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Tests\Feature; namespace Tests\Feature\Http\Controllers\Auth;
use App\Models\User; use App\Models\User;
use App\Providers\RouteServiceProvider; use App\Providers\RouteServiceProvider;
@ -14,7 +14,7 @@ class EmailVerificationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_email_verification_screen_can_be_rendered() public function testEmailVerificationScreenCanBeRendered()
{ {
$user = User::factory()->create([ $user = User::factory()->create([
'email_verified_at' => null, 'email_verified_at' => null,
@ -25,7 +25,7 @@ class EmailVerificationTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_email_can_be_verified() public function testEmailCanBeVerified()
{ {
Event::fake(); Event::fake();
@ -46,7 +46,7 @@ class EmailVerificationTest extends TestCase
$response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1');
} }
public function test_email_is_not_verified_with_invalid_hash() public function testEmailIsNotVerifiedWithInvalidHash()
{ {
$user = User::factory()->create([ $user = User::factory()->create([
'email_verified_at' => null, 'email_verified_at' => null,

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Tests\Feature; namespace Tests\Feature\Http\Controllers\Auth;
use App\Models\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
@ -10,7 +10,7 @@ class PasswordConfirmationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_confirm_password_screen_can_be_rendered() public function testConfirmPasswordScreenCanBeRendered()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -19,7 +19,7 @@ class PasswordConfirmationTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_password_can_be_confirmed() public function testPasswordCanBeConfirmed()
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -31,7 +31,7 @@ class PasswordConfirmationTest extends TestCase
$response->assertSessionHasNoErrors(); $response->assertSessionHasNoErrors();
} }
public function test_password_is_not_confirmed_with_invalid_password() public function testPasswordIsNotConfirmedWithInvalidPassword()
{ {
$user = User::factory()->create(); $user = User::factory()->create();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Tests\Feature; namespace Tests\Feature\Http\Controllers\Auth;
use App\Models\User; use App\Models\User;
use Illuminate\Auth\Notifications\ResetPassword; use Illuminate\Auth\Notifications\ResetPassword;
@ -12,14 +12,14 @@ class PasswordResetTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_reset_password_link_screen_can_be_rendered() public function testResetPasswordLinkScreenCanBeRendered()
{ {
$response = $this->get('/forgot-password'); $response = $this->get('/forgot-password');
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_reset_password_link_can_be_requested() public function testResetPasswordLinkCanBeRequested()
{ {
Notification::fake(); Notification::fake();
@ -30,7 +30,7 @@ class PasswordResetTest extends TestCase
Notification::assertSentTo($user, ResetPassword::class); Notification::assertSentTo($user, ResetPassword::class);
} }
public function test_reset_password_screen_can_be_rendered() public function testResetPasswordScreenCanBeRendered()
{ {
Notification::fake(); Notification::fake();
@ -47,7 +47,7 @@ class PasswordResetTest extends TestCase
}); });
} }
public function test_password_can_be_reset_with_valid_token() public function testPasswordCanBeResetWithValidToken()
{ {
Notification::fake(); Notification::fake();