Skip to content

Commit 11e926c

Browse files
committed
- Changed tests stubs to use php attribute instead of docblock to add support for phpunit 12
1 parent 407ef90 commit 11e926c

File tree

7 files changed

+122
-115
lines changed

7 files changed

+122
-115
lines changed

stubs/tests/ModelApiControllerTest.stub

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ namespace Tests\Feature\Controllers\Api;
44

55
use App\Models\{{singularStudly}};
66
use Illuminate\Foundation\Testing\RefreshDatabase;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class {{pluralStudly}}ControllerTest extends ApiTestCase
910
{
1011
use RefreshDatabase;
1112

12-
/** @test */
13+
#[Test]
1314
public function it_can_list_api_{{pluralSnake}}_for_public_users(): void
1415
{
1516
$this->withoutExceptionHandling();
@@ -26,7 +27,7 @@ class {{pluralStudly}}ControllerTest extends ApiTestCase
2627

2728
}
2829

29-
/** @test */
30+
#[Test]
3031
public function it_can_show_api_{{pluralSnake}}_for_public_users(): void
3132
{
3233
$this->withoutExceptionHandling();
@@ -42,7 +43,7 @@ class {{pluralStudly}}ControllerTest extends ApiTestCase
4243
]);
4344
}
4445

45-
/** @test */
46+
#[Test]
4647
public function it_can_list_api_{{pluralSnake}}_for_admin_users(): void
4748
{
4849
$this->withoutExceptionHandling();
@@ -59,7 +60,7 @@ class {{pluralStudly}}ControllerTest extends ApiTestCase
5960

6061
}
6162

62-
/** @test */
63+
#[Test]
6364
public function it_can_show_api_{{pluralSnake}}_for_admin_users(): void
6465
{
6566
$this->withoutExceptionHandling();

stubs/tests/ModelControllerTest.stub

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
namespace Tests\Feature\Controllers\Admin;
44

55
use Illuminate\Foundation\Testing\RefreshDatabase;
6+
use PHPUnit\Framework\Attributes\Test;
67
// use statements
78

89
class {{pluralStudly}}ControllerTest extends AdminTestCase
910
{
1011
use RefreshDatabase;
1112

12-
/** @test */
13+
#[Test]
1314
public function it_can_list_{{pluralSnake}}()
1415
{
1516
$this->withoutExceptionHandling();
@@ -23,7 +24,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
2324
->assertSee(${{singularSnake}}->{{nameField}});
2425
}
2526

26-
/** @test */
27+
#[Test]
2728
public function it_can_filter_{{pluralSnake}}()
2829
{
2930
$this->withoutExceptionHandling();
@@ -42,7 +43,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
4243
->assertSee(${{singularSnake}}->{{nameField}});
4344
}
4445

45-
/** @test */
46+
#[Test]
4647
public function it_can_export_{{pluralSnake}}()
4748
{
4849
$this->withoutExceptionHandling();
@@ -61,7 +62,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
6162
});
6263
}
6364

64-
/** @test */
65+
#[Test]
6566
public function it_does_not_allow_an_unauthorized_user_to_list_{{pluralSnake}}()
6667
{
6768
$this->actingAsAdmin();
@@ -73,7 +74,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
7374
->assertDontSee(${{singularSnake}}->{{nameField}});
7475
}
7576

76-
/** @test */
77+
#[Test]
7778
public function it_can_show_the_create_new_{{singularSnake}}_page()
7879
{
7980
$this->withoutExceptionHandling();
@@ -85,7 +86,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
8586
->assertSee('New {{singularTitle}}');
8687
}
8788

88-
/** @test */
89+
#[Test]
8990
public function it_does_not_allow_an_unauthorized_user_to_see_the_create_new_{{singularSnake}}_page()
9091
{
9192
$this->actingAsAdmin();
@@ -95,7 +96,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
9596
->assertDontSee('New {{singularTitle}}');
9697
}
9798

98-
/** @test */
99+
#[Test]
99100
public function it_can_create_a_new_{{singularSnake}}()
100101
{
101102
$this->withoutExceptionHandling();
@@ -115,7 +116,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
115116
]);
116117
}
117118

118-
/** @test */
119+
#[Test]
119120
public function it_does_not_allow_an_unauthorized_user_to_add_a_{{singularSnake}}()
120121
{
121122
$this->actingAsAdmin();
@@ -133,7 +134,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
133134
]);
134135
}
135136

136-
/** @test */
137+
#[Test]
137138
public function it_can_show_the_edit_{{singularSnake}}_page()
138139
{
139140
$this->withoutExceptionHandling();
@@ -147,7 +148,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
147148
->assertSee(${{singularSnake}}->{{nameField}});
148149
}
149150

150-
/** @test */
151+
#[Test]
151152
public function it_does_not_allow_an_unauthorized_user_to_see_the_edit_{{singularSnake}}_page()
152153
{
153154
$this->actingAsAdmin();
@@ -159,7 +160,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
159160
->assertDontSee(${{singularSnake}}->{{nameField}});
160161
}
161162

162-
/** @test */
163+
#[Test]
163164
public function it_can_update_a_{{singularSnake}}()
164165
{
165166
$this->withoutExceptionHandling();
@@ -184,7 +185,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
184185
]);
185186
}
186187

187-
/** @test */
188+
#[Test]
188189
public function it_does_not_allow_an_unauthorized_user_to_update_a_{{singularSnake}}()
189190
{
190191
$this->actingAsAdmin();
@@ -207,7 +208,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
207208
]);
208209
}
209210

210-
/** @test */
211+
#[Test]
211212
public function it_can_show_a_{{singularSnake}}()
212213
{
213214
$this->withoutExceptionHandling();
@@ -221,7 +222,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
221222
->assertSee(${{singularSnake}}->{{nameField}});
222223
}
223224

224-
/** @test */
225+
#[Test]
225226
public function it_does_not_allow_an_unauthorized_user_to_view_a_{{singularSnake}}()
226227
{
227228
$this->actingAsAdmin();
@@ -233,7 +234,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
233234
->assertDontSee(${{singularSnake}}->{{nameField}});
234235
}
235236

236-
/** @test */
237+
#[Test]
237238
public function it_can_delete_a_{{singularSnake}}()
238239
{
239240
$this->withoutExceptionHandling();
@@ -254,7 +255,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
254255
]);
255256
}
256257

257-
/** @test */
258+
#[Test]
258259
public function it_does_not_allow_an_unauthorized_user_to_delete_a_{{singularSnake}}()
259260
{
260261
$this->actingAsAdmin();
@@ -273,7 +274,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
273274
]);
274275
}
275276

276-
/** @test */
277+
#[Test]
277278
public function it_can_bulk_delete_{{pluralSnake}}()
278279
{
279280
$this->withoutExceptionHandling();
@@ -306,7 +307,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
306307
});
307308
}
308309

309-
/** @test */
310+
#[Test]
310311
public function it_does_not_allow_unauthorized_users_to_bulk_delete_{{pluralSnake}}()
311312
{
312313
$this->actingAsAdmin('view_{{pluralSnake}}');
@@ -337,7 +338,7 @@ class {{pluralStudly}}ControllerTest extends AdminTestCase
337338
});
338339
}
339340

340-
/** @test */
341+
#[Test]
341342
public function it_can_validate_{{singularSnake}}_inputs()
342343
{
343344
$this->actingAsAdmin('edit_{{pluralSnake}}');

0 commit comments

Comments
 (0)