Skip to content

Commit 1790573

Browse files
committed
Use Named Routes for Tests
1 parent fb6f380 commit 1790573

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

tests/Feature/Auth/AuthenticationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AuthenticationTest extends TestCase
1313

1414
public function test_login_screen_can_be_rendered(): void
1515
{
16-
$response = $this->get('/login');
16+
$response = $this->get(route('login'));
1717

1818
$response->assertStatus(200);
1919
}
@@ -52,9 +52,9 @@ public function test_users_can_logout(): void
5252
{
5353
$user = User::factory()->create();
5454

55-
$response = $this->actingAs($user)->post('/logout');
55+
$response = $this->actingAs($user)->post(route('logout'));
5656

57-
$response->assertRedirect('/');
57+
$response->assertRedirect(route('home'));
5858

5959
$this->assertGuest();
6060
}

tests/Feature/Auth/EmailVerificationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function test_email_verification_screen_can_be_rendered(): void
1717
{
1818
$user = User::factory()->unverified()->create();
1919

20-
$response = $this->actingAs($user)->get('/verify-email');
20+
$response = $this->actingAs($user)->get(route('verification.notice'));
2121

2222
$response->assertStatus(200);
2323
}

tests/Feature/Auth/PasswordConfirmationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function test_confirm_password_screen_can_be_rendered(): void
1515
{
1616
$user = User::factory()->create();
1717

18-
$response = $this->actingAs($user)->get('/confirm-password');
18+
$response = $this->actingAs($user)->get(route('password.confirm'));
1919

2020
$response->assertStatus(200);
2121
}

tests/Feature/Auth/PasswordResetTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PasswordResetTest extends TestCase
1515

1616
public function test_reset_password_link_screen_can_be_rendered(): void
1717
{
18-
$response = $this->get('/forgot-password');
18+
$response = $this->get(route('password.request'));
1919

2020
$response->assertStatus(200);
2121
}
@@ -44,7 +44,7 @@ public function test_reset_password_screen_can_be_rendered(): void
4444
->call('sendPasswordResetLink');
4545

4646
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
47-
$response = $this->get('/reset-password/'.$notification->token);
47+
$response = $this->get(route('password.reset', $notification->token));
4848

4949
$response->assertStatus(200);
5050

tests/Feature/Auth/RegistrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class RegistrationTest extends TestCase
1212

1313
public function test_registration_screen_can_be_rendered(): void
1414
{
15-
$response = $this->get('/register');
15+
$response = $this->get(route('register'));
1616

1717
$response->assertStatus(200);
1818
}

tests/Feature/DashboardTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ class DashboardTest extends TestCase
1212

1313
public function test_guests_are_redirected_to_the_login_page(): void
1414
{
15-
$response = $this->get('/dashboard');
16-
$response->assertRedirect('/login');
15+
$response = $this->get(route('dashboard'));
16+
$response->assertRedirect(route('login'));
1717
}
1818

1919
public function test_authenticated_users_can_visit_the_dashboard(): void
2020
{
2121
$user = User::factory()->create();
2222
$this->actingAs($user);
2323

24-
$response = $this->get('/dashboard');
24+
$response = $this->get(route('dashboard'));
2525
$response->assertStatus(200);
2626
}
2727
}

tests/Feature/ExampleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ExampleTest extends TestCase
1111

1212
public function test_returns_a_successful_response(): void
1313
{
14-
$response = $this->get('/');
14+
$response = $this->get(route('home'));
1515

1616
$response->assertStatus(200);
1717
}

tests/Feature/Settings/ProfileUpdateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function test_profile_page_is_displayed(): void
1515
{
1616
$this->actingAs($user = User::factory()->create());
1717

18-
$this->get('/settings/profile')->assertOk();
18+
$this->get(route('settings.profile'))->assertOk();
1919
}
2020

2121
public function test_profile_information_can_be_updated(): void

0 commit comments

Comments
 (0)