Skip to content

Commit cd29157

Browse files
committed
- Testing Laravel 12 support
1 parent 7c24387 commit cd29157

14 files changed

+92
-78
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
fail-fast: true
1717
matrix:
1818
os: [ ubuntu-latest ]
19-
php: [ 8.3, 8.2 ]
20-
laravel: [ ^11.7 ]
19+
php: [ 8.4, 8.3, 8.2 ]
20+
laravel: [ 12.*, ^11.7 ]
2121
stability: [ prefer-lowest, prefer-stable ]
2222
include:
23+
- laravel: 12.*
24+
testbench: 10.*
2325
- laravel: ^11.7
2426
testbench: 9.*
2527

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
],
1212
"require": {
1313
"php": "^8.2",
14-
"illuminate/support": "^11.7",
15-
"javaabu/helpers": "^1.44",
16-
"javaabu/activitylog": "^1.1",
14+
"illuminate/support": "^11.7 || ^12.0",
15+
"javaabu/helpers": "^1.59",
16+
"javaabu/activitylog": "^1.4",
1717
"laravel/ui": "^4.4",
18-
"javaabu/passport": "^1.1",
18+
"javaabu/passport": "^1.2",
1919
"spatie/laravel-medialibrary": "^11.0",
2020
"mobiledetect/mobiledetectlib": "^4.8",
21-
"javaabu/schema": "^1.0"
21+
"javaabu/schema": "^1.1"
2222
},
2323
"require-dev": {
24-
"orchestra/testbench": "^9.0",
25-
"phpunit/phpunit": "^10.5"
24+
"orchestra/testbench": "^9.0 || ^10.0",
25+
"phpunit/phpunit": "^10.5 || ^11.5.3"
2626
},
2727
"autoload": {
2828
"psr-4": {

tests/Feature/ConfirmPasswordControllerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Facades\Hash;
77
use Javaabu\Auth\Tests\InteractsWithDatabase;
88
use Javaabu\Auth\Tests\TestCase;
9+
use PHPUnit\Framework\Attributes\Test;
910

1011
class ConfirmPasswordControllerTest extends TestCase
1112
{
@@ -20,7 +21,7 @@ public function setUp(): void
2021
$this->seedDefaultUsers();
2122
}
2223

23-
/** @test */
24+
#[Test]
2425
public function it_redirects_to_the_password_confirmation_page_if_the_user_is_required_to_confirm_the_password()
2526
{
2627
$user = $this->getUser('user@example.com');
@@ -31,7 +32,7 @@ public function it_redirects_to_the_password_confirmation_page_if_the_user_is_re
3132
->assertRedirect('/password/confirm');
3233
}
3334

34-
/** @test */
35+
#[Test]
3536
public function it_can_display_the_password_confirmation_page()
3637
{
3738
$this->withoutExceptionHandling();
@@ -44,7 +45,7 @@ public function it_can_display_the_password_confirmation_page()
4445
->assertSee('Confirm Password');
4546
}
4647

47-
/** @test */
48+
#[Test]
4849
public function it_does_not_allow_the_password_to_be_confirmed_using_an_invalid_current_password()
4950
{
5051
$user = $this->getUser('user@example.com');
@@ -61,7 +62,7 @@ public function it_does_not_allow_the_password_to_be_confirmed_using_an_invalid_
6162
->assertRedirect();
6263
}
6364

64-
/** @test */
65+
#[Test]
6566
public function it_can_confirm_the_password()
6667
{
6768
$this->withoutExceptionHandling();

tests/Feature/ForgotPasswordControllerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Javaabu\Auth\Notifications\ResetPassword;
88
use Javaabu\Auth\Tests\InteractsWithDatabase;
99
use Javaabu\Auth\Tests\TestCase;
10+
use PHPUnit\Framework\Attributes\Test;
1011
use Spatie\Activitylog\Models\Activity;
1112

1213
class ForgotPasswordControllerTest extends TestCase
@@ -22,15 +23,15 @@ public function setUp(): void
2223
$this->seedDefaultUsers();
2324
}
2425

25-
/** @test */
26+
#[Test]
2627
public function it_can_display_the_forgot_password_page()
2728
{
2829
$this->get('/password/reset')
2930
->assertStatus(200)
3031
->assertSee('Forgot Password');
3132
}
3233

33-
/** @test */
34+
#[Test]
3435
public function it_can_send_the_forgot_password_link()
3536
{
3637
$user = $this->getUser('user@example.com');
@@ -46,7 +47,7 @@ public function it_can_send_the_forgot_password_link()
4647
);
4748
}
4849

49-
/** @test */
50+
#[Test]
5051
public function it_records_the_password_reset_link_sent_event()
5152
{
5253
$this->withoutExceptionHandling();
@@ -80,7 +81,7 @@ public function it_records_the_password_reset_link_sent_event()
8081
]);
8182
}
8283

83-
/** @test */
84+
#[Test]
8485
public function it_can_validate_the_forgot_password_inputs()
8586
{
8687
$user = $this->getUser('user@example.com');

tests/Feature/LoginControllerTest.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\Hash;
88
use Javaabu\Auth\Tests\InteractsWithDatabase;
99
use Javaabu\Auth\Tests\TestCase;
10+
use PHPUnit\Framework\Attributes\Test;
1011
use Spatie\Activitylog\Models\Activity;
1112

1213
class LoginControllerTest extends TestCase
@@ -22,15 +23,15 @@ public function setUp(): void
2223
$this->seedDefaultUsers();
2324
}
2425

25-
/** @test */
26+
#[Test]
2627
public function it_can_show_the_login_form_page(): void
2728
{
2829
$this->get('/login')
2930
->assertStatus(200)
3031
->assertViewIs('login');
3132
}
3233

33-
/** @test */
34+
#[Test]
3435
public function it_can_login_a_user(): void
3536
{
3637
$user = $this->getUser('user@example.com');
@@ -45,7 +46,7 @@ public function it_can_login_a_user(): void
4546
$this->assertEquals($user->id, Auth::guard('web')->id());
4647
}
4748

48-
/** @test */
49+
#[Test]
4950
public function it_records_the_login_event()
5051
{
5152
$now = '2024-09-08 12:56:00';
@@ -85,7 +86,7 @@ public function it_records_the_login_event()
8586
]);
8687
}
8788

88-
/** @test */
89+
#[Test]
8990
public function it_can_logout_a_user(): void
9091
{
9192
$this->withoutExceptionHandling();
@@ -108,7 +109,7 @@ public function it_can_logout_a_user(): void
108109
$this->assertNull(Auth::guard('web')->id(), 'Invalid logged in user id');
109110
}
110111

111-
/** @test */
112+
#[Test]
112113
public function it_records_logout_events(): void
113114
{
114115
$this->withoutExceptionHandling();
@@ -146,7 +147,7 @@ public function it_records_logout_events(): void
146147
]);
147148
}
148149

149-
/** @test */
150+
#[Test]
150151
public function it_can_validate_the_login_inputs()
151152
{
152153
$this->post('/login', [
@@ -156,7 +157,7 @@ public function it_can_validate_the_login_inputs()
156157
->assertSessionHasErrors('password', 'email');
157158
}
158159

159-
/** @test */
160+
#[Test]
160161
public function it_does_not_allow_a_user_to_be_logged_in_using_an_invalid_password()
161162
{
162163
$this->post('/login', [
@@ -168,7 +169,7 @@ public function it_does_not_allow_a_user_to_be_logged_in_using_an_invalid_passwo
168169
$this->assertNull(Auth::guard('web')->id(), 'Invalid logged in user id');
169170
}
170171

171-
/** @test */
172+
#[Test]
172173
public function it_records_failed_login_events()
173174
{
174175
$now = '2024-09-08 12:56:00';
@@ -202,7 +203,7 @@ public function it_records_failed_login_events()
202203
]);
203204
}
204205

205-
/** @test */
206+
#[Test]
206207
public function it_increments_the_users_login_attempts_if_an_invalid_password_is_entered()
207208
{
208209
$user = $this->getUser('user@example.com');
@@ -226,7 +227,7 @@ public function it_increments_the_users_login_attempts_if_an_invalid_password_is
226227
]);
227228
}
228229

229-
/** @test */
230+
#[Test]
230231
public function it_records_lockout_events()
231232
{
232233
$now = '2024-09-08 12:56:00';
@@ -255,7 +256,7 @@ public function it_records_lockout_events()
255256
]);
256257
}
257258

258-
/** @test */
259+
#[Test]
259260
public function it_resets_the_login_attempts_when_the_correct_password_is_entered()
260261
{
261262
$this->withoutExceptionHandling();
@@ -284,7 +285,7 @@ public function it_resets_the_login_attempts_when_the_correct_password_is_entere
284285
]);
285286
}
286287

287-
/** @test */
288+
#[Test]
288289
public function it_does_not_reset_the_login_attempts_if_the_user_is_already_locked_out_even_when_the_correct_password_is_entered()
289290
{
290291
$user = $this->getUser('user@example.com');
@@ -312,7 +313,7 @@ public function it_does_not_reset_the_login_attempts_if_the_user_is_already_lock
312313
]);
313314
}
314315

315-
/** @test */
316+
#[Test]
316317
public function it_shows_a_lock_out_message_if_there_are_too_many_login_attempts()
317318
{
318319
$this->withoutExceptionHandling();

tests/Feature/MultiAuthDatabaseSessionHandlerTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Javaabu\Auth\Session\Session;
1010
use Javaabu\Auth\Tests\InteractsWithDatabase;
1111
use Javaabu\Auth\Tests\TestCase;
12+
use PHPUnit\Framework\Attributes\Test;
1213

1314
class MultiAuthDatabaseSessionHandlerTest extends TestCase
1415
{
@@ -25,7 +26,7 @@ public function setUp(): void
2526
$this->seedDefaultUsers();
2627
}
2728

28-
/** @test */
29+
#[Test]
2930
public function it_records_the_user_type_in_the_sessions_table(): void
3031
{
3132
$user = $this->getUser('user@example.com');
@@ -46,7 +47,7 @@ public function it_records_the_user_type_in_the_sessions_table(): void
4647
]);
4748
}
4849

49-
/** @test */
50+
#[Test]
5051
public function it_can_record_session_data_even_when_not_logged_in(): void
5152
{
5253
$this->post('/session-test')
@@ -62,7 +63,7 @@ public function it_can_record_session_data_even_when_not_logged_in(): void
6263
]);
6364
}
6465

65-
/** @test */
66+
#[Test]
6667
public function it_can_retrieve_the_sessions_of_a_user(): void
6768
{
6869
$user = $this->getUser('user@example.com');
@@ -84,7 +85,7 @@ public function it_can_retrieve_the_sessions_of_a_user(): void
8485
$this->assertEquals('user@example.com', $last_session->user->email);
8586
}
8687

87-
/** @test */
88+
#[Test]
8889
public function it_knows_the_current_device(): void
8990
{
9091
$user = $this->getUser('user@example.com');
@@ -120,7 +121,7 @@ public function it_knows_the_current_device(): void
120121
$this->assertEquals($user->getMorphClass(), $old_session->user_type);
121122
}
122123

123-
/** @test */
124+
#[Test]
124125
public function it_creates_the_session_user_agent(): void
125126
{
126127
$user = $this->getUser('user@example.com');
@@ -142,7 +143,7 @@ public function it_creates_the_session_user_agent(): void
142143
$this->assertInstanceOf(Agent::class, $last_session->agent);
143144
}
144145

145-
/** @test */
146+
#[Test]
146147
public function it_records_the_last_activity_time(): void
147148
{
148149
$user = $this->getUser('user@example.com');
@@ -164,7 +165,7 @@ public function it_records_the_last_activity_time(): void
164165
$this->assertInstanceOf(Carbon::class, $last_session->last_activity);
165166
}
166167

167-
/** @test */
168+
#[Test]
168169
public function it_can_delete_other_sessions_of_the_user(): void
169170
{
170171
$user = $this->getUser('user@example.com');

tests/Feature/RegisterControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Javaabu\Auth\Tests\Feature\Models\User;
1111
use Javaabu\Auth\Tests\InteractsWithDatabase;
1212
use Javaabu\Auth\Tests\TestCase;
13+
use PHPUnit\Framework\Attributes\Test;
1314

1415
class RegisterControllerTest extends TestCase
1516
{
@@ -24,7 +25,7 @@ public function setUp(): void
2425
$this->seedDefaultUsers();
2526
}
2627

27-
/** @test */
28+
#[Test]
2829
public function it_can_display_the_user_registration_page()
2930
{
3031
$this->withoutExceptionHandling();
@@ -34,7 +35,7 @@ public function it_can_display_the_user_registration_page()
3435
->assertSee('Register');
3536
}
3637

37-
/** @test */
38+
#[Test]
3839
public function it_can_register_a_user()
3940
{
4041
$this->withoutExceptionHandling();
@@ -71,7 +72,7 @@ public function it_can_register_a_user()
7172
1);
7273
}
7374

74-
/** @test */
75+
#[Test]
7576
public function it_can_validate_the_registration_inputs()
7677
{
7778
$this->post('/register', [

0 commit comments

Comments
 (0)