6
6
use Blueprint \Contracts \Generator ;
7
7
use Blueprint \Contracts \Lexer ;
8
8
use Blueprint \Tree ;
9
+ use PHPUnit \Framework \Attributes \DataProvider ;
10
+ use PHPUnit \Framework \Attributes \Test ;
9
11
use Symfony \Component \Yaml \Exception \ParseException ;
10
12
use Tests \TestCase ;
11
13
12
14
/**
13
15
* @see Blueprint
14
16
*/
15
- class BlueprintTest extends TestCase
17
+ final class BlueprintTest extends TestCase
16
18
{
17
19
/**
18
20
* @var Blueprint
@@ -26,10 +28,8 @@ protected function setUp(): void
26
28
$ this ->subject = new Blueprint ();
27
29
}
28
30
29
- /**
30
- * @test
31
- */
32
- public function it_parses_models ()
31
+ #[Test]
32
+ public function it_parses_models (): void
33
33
{
34
34
$ blueprint = $ this ->fixture ('drafts/models-only.yaml ' );
35
35
@@ -68,10 +68,8 @@ public function it_parses_seeders()
68
68
], $ this ->subject ->parse ($ blueprint ));
69
69
}
70
70
71
- /**
72
- * @test
73
- */
74
- public function it_parses_controllers ()
71
+ #[Test]
72
+ public function it_parses_controllers (): void
75
73
{
76
74
$ blueprint = $ this ->fixture ('drafts/controllers-only.yaml ' );
77
75
@@ -95,10 +93,8 @@ public function it_parses_controllers()
95
93
], $ this ->subject ->parse ($ blueprint ));
96
94
}
97
95
98
- /**
99
- * @test
100
- */
101
- public function it_parses_shorthands ()
96
+ #[Test]
97
+ public function it_parses_shorthands (): void
102
98
{
103
99
$ blueprint = $ this ->fixture ('drafts/shorthands.yaml ' );
104
100
@@ -121,10 +117,8 @@ public function it_parses_shorthands()
121
117
], $ this ->subject ->parse ($ blueprint ));
122
118
}
123
119
124
- /**
125
- * @test
126
- */
127
- public function it_parses_uuid_shorthand ()
120
+ #[Test]
121
+ public function it_parses_uuid_shorthand (): void
128
122
{
129
123
$ blueprint = $ this ->fixture ('drafts/uuid-shorthand.yaml ' );
130
124
@@ -139,10 +133,8 @@ public function it_parses_uuid_shorthand()
139
133
], $ this ->subject ->parse ($ blueprint ));
140
134
}
141
135
142
- /**
143
- * @test
144
- */
145
- public function it_parses_shorthands_with_timezones ()
136
+ #[Test]
137
+ public function it_parses_shorthands_with_timezones (): void
146
138
{
147
139
$ blueprint = $ this ->fixture ('drafts/with-timezones.yaml ' );
148
140
@@ -156,10 +148,8 @@ public function it_parses_shorthands_with_timezones()
156
148
], $ this ->subject ->parse ($ blueprint ));
157
149
}
158
150
159
- /**
160
- * @test
161
- */
162
- public function it_parses_longhands ()
151
+ #[Test]
152
+ public function it_parses_longhands (): void
163
153
{
164
154
$ blueprint = $ this ->fixture ('drafts/longhands.yaml ' );
165
155
@@ -183,10 +173,8 @@ public function it_parses_longhands()
183
173
], $ this ->subject ->parse ($ blueprint ));
184
174
}
185
175
186
- /**
187
- * @test
188
- */
189
- public function it_parses_resource_shorthands ()
176
+ #[Test]
177
+ public function it_parses_resource_shorthands (): void
190
178
{
191
179
$ blueprint = $ this ->fixture ('drafts/with-timezones.yaml ' );
192
180
@@ -200,10 +188,8 @@ public function it_parses_resource_shorthands()
200
188
], $ this ->subject ->parse ($ blueprint ));
201
189
}
202
190
203
- /**
204
- * @test
205
- */
206
- public function it_parses_the_readme_example ()
191
+ #[Test]
192
+ public function it_parses_the_readme_example (): void
207
193
{
208
194
$ blueprint = $ this ->fixture ('drafts/readme-example.yaml ' );
209
195
@@ -236,10 +222,8 @@ public function it_parses_the_readme_example()
236
222
], $ this ->subject ->parse ($ blueprint ));
237
223
}
238
224
239
- /**
240
- * @test
241
- */
242
- public function it_parses_the_readme_example_with_different_platform_eols ()
225
+ #[Test]
226
+ public function it_parses_the_readme_example_with_different_platform_eols (): void
243
227
{
244
228
$ definition = $ this ->fixture ('drafts/readme-example.yaml ' );
245
229
@@ -282,10 +266,8 @@ public function it_parses_the_readme_example_with_different_platform_eols()
282
266
$ this ->assertEquals ($ expected , $ this ->subject ->parse ($ definition_windows_eol ));
283
267
}
284
268
285
- /**
286
- * @test
287
- */
288
- public function it_parses_yaml_with_dashed_syntax ()
269
+ #[Test]
270
+ public function it_parses_yaml_with_dashed_syntax (): void
289
271
{
290
272
$ definition = $ this ->fixture ('drafts/readme-example-dashes.yaml ' );
291
273
@@ -314,10 +296,8 @@ public function it_parses_yaml_with_dashed_syntax()
314
296
$ this ->assertEquals ($ expected , $ this ->subject ->parse ($ definition ));
315
297
}
316
298
317
- /**
318
- * @test
319
- */
320
- public function it_allows_parsing_without_stripping_dashes ()
299
+ #[Test]
300
+ public function it_allows_parsing_without_stripping_dashes (): void
321
301
{
322
302
$ sequence = [
323
303
'numbers ' => range (3 , 11 ),
@@ -326,10 +306,8 @@ public function it_allows_parsing_without_stripping_dashes()
326
306
$ this ->assertEquals ($ sequence , $ this ->subject ->parse ($ this ->subject ->dump ($ sequence ), false ));
327
307
}
328
308
329
- /**
330
- * @test
331
- */
332
- public function it_throws_a_custom_error_when_parsing_fails ()
309
+ #[Test]
310
+ public function it_throws_a_custom_error_when_parsing_fails (): void
333
311
{
334
312
$ this ->expectException (ParseException::class);
335
313
@@ -338,10 +316,8 @@ public function it_throws_a_custom_error_when_parsing_fails()
338
316
$ this ->subject ->parse ($ blueprint );
339
317
}
340
318
341
- /**
342
- * @test
343
- */
344
- public function analyze_return_default_tree_for_empty_tokens ()
319
+ #[Test]
320
+ public function analyze_return_default_tree_for_empty_tokens (): void
345
321
{
346
322
$ tokens = [];
347
323
@@ -354,10 +330,8 @@ public function analyze_return_default_tree_for_empty_tokens()
354
330
);
355
331
}
356
332
357
- /**
358
- * @test
359
- */
360
- public function analyze_uses_register_lexers_to_analyze_tokens ()
333
+ #[Test]
334
+ public function analyze_uses_register_lexers_to_analyze_tokens (): void
361
335
{
362
336
$ lexer = \Mockery::mock (Lexer::class);
363
337
$ tokens = ['tokens ' => ['are ' , 'here ' ]];
@@ -374,10 +348,8 @@ public function analyze_uses_register_lexers_to_analyze_tokens()
374
348
], $ this ->subject ->analyze ($ tokens )->toArray ());
375
349
}
376
350
377
- /**
378
- * @test
379
- */
380
- public function generate_uses_registered_generators_and_returns_generated_files ()
351
+ #[Test]
352
+ public function generate_uses_registered_generators_and_returns_generated_files (): void
381
353
{
382
354
$ generatorOne = \Mockery::mock (Generator::class);
383
355
$ tree = new Tree (['branch ' => ['code ' , 'attributes ' ]]);
@@ -421,10 +393,8 @@ public function generate_uses_registered_generators_and_returns_generated_files(
421
393
], $ this ->subject ->generate ($ tree ));
422
394
}
423
395
424
- /**
425
- * @test
426
- */
427
- public function generate_uses_swapped_generator_and_returns_generated_files ()
396
+ #[Test]
397
+ public function generate_uses_swapped_generator_and_returns_generated_files (): void
428
398
{
429
399
$ generatorOne = \Mockery::mock (Generator::class);
430
400
$ tree = new Tree (['branch ' => ['code ' , 'attributes ' ]]);
@@ -456,10 +426,8 @@ public function generate_uses_swapped_generator_and_returns_generated_files()
456
426
], $ this ->subject ->generate ($ tree ));
457
427
}
458
428
459
- /**
460
- * @test
461
- */
462
- public function generate_only_one_specific_type ()
429
+ #[Test]
430
+ public function generate_only_one_specific_type (): void
463
431
{
464
432
$ generatorFoo = \Mockery::mock (Generator::class);
465
433
$ tree = new Tree (['branch ' => ['code ' , 'attributes ' ]]);
@@ -507,10 +475,8 @@ public function generate_only_one_specific_type()
507
475
], $ actual );
508
476
}
509
477
510
- /**
511
- * @test
512
- */
513
- public function generate_only_specific_types ()
478
+ #[Test]
479
+ public function generate_only_specific_types (): void
514
480
{
515
481
$ generatorFoo = \Mockery::mock (Generator::class);
516
482
$ tree = new Tree (['branch ' => ['code ' , 'attributes ' ]]);
@@ -558,10 +524,8 @@ public function generate_only_specific_types()
558
524
], $ actual );
559
525
}
560
526
561
- /**
562
- * @test
563
- */
564
- public function generate_should_skip_one_specific_type ()
527
+ #[Test]
528
+ public function generate_should_skip_one_specific_type (): void
565
529
{
566
530
$ generatorFoo = \Mockery::mock (Generator::class);
567
531
$ tree = new Tree (['branch ' => ['code ' , 'attributes ' ]]);
@@ -609,10 +573,8 @@ public function generate_should_skip_one_specific_type()
609
573
], $ actual );
610
574
}
611
575
612
- /**
613
- * @test
614
- */
615
- public function generate_should_skip_specific_types ()
576
+ #[Test]
577
+ public function generate_should_skip_specific_types (): void
616
578
{
617
579
$ generatorFoo = \Mockery::mock (Generator::class);
618
580
$ tree = new Tree (['branch ' => ['code ' , 'attributes ' ]]);
@@ -660,19 +622,16 @@ public function generate_should_skip_specific_types()
660
622
], $ actual );
661
623
}
662
624
663
- /**
664
- * @test
665
- *
666
- * @dataProvider namespacesDataProvider
667
- */
668
- public function relative_namespace_removes_namespace_prefix_from_reference ($ namespace , $ expected , $ reference )
625
+ #[Test]
626
+ #[DataProvider('namespacesDataProvider ' )]
627
+ public function relative_namespace_removes_namespace_prefix_from_reference ($ namespace , $ expected , $ reference ): void
669
628
{
670
629
config (['blueprint.namespace ' => $ namespace ]);
671
630
672
631
$ this ->assertEquals ($ expected , Blueprint::relativeNamespace ($ reference ));
673
632
}
674
633
675
- public function namespacesDataProvider ()
634
+ public static function namespacesDataProvider (): array
676
635
{
677
636
return [
678
637
['App ' , 'Models\User ' , 'App\Models\User ' ],
0 commit comments