33namespace Tests ;
44
55use Illuminate \Testing \TestResponse ;
6+ use PHPUnit \Framework \Attributes \DataProvider ;
67
78class BuilderTest extends TestCase
89{
910
10- public function provider ()
11+ public static function provider (): array
1112 {
1213 return [
1314 [200 , [], [], []],
1415 ];
1516 }
1617
1718
18- /**
19- * @dataProvider provider
20- */
21- public function testResponsePropertiesAreSet ($ status , $ data , $ messages , $ meta )
19+ #[DataProvider('provider ' )]
20+ public function testResponsePropertiesAreSet ($ status , $ data , $ messages , $ meta ): void
2221 {
2322 $ builder = api ()->status ($ status )->data ($ data )->messages ($ messages )->meta ($ meta );
2423
@@ -28,26 +27,26 @@ public function testResponsePropertiesAreSet($status, $data, $messages, $meta)
2827 $ this ->assertEquals ($ meta , $ builder ->body ()->getMeta ());
2928 }
3029
31- public function testAddMessageToResponse ()
30+ public function testAddMessageToResponse (): void
3231 {
3332 $ builder = api ()->message ('Hello World ' );
3433
3534 $ this ->assertEquals (['Hello World ' ], $ builder ->body ()->getMessages ());
3635 }
3736
38- public function testAddingHeaderToResponse ()
37+ public function testAddingHeaderToResponse (): void
3938 {
40- $ response = new TestResponse (api ()->header ('foo ' , 'bar ' )->respond ());
39+ $ testResponse = new TestResponse (api ()->header ('foo ' , 'bar ' )->respond ());
4140
42- $ response ->assertHeader ('foo ' );
41+ $ testResponse ->assertHeader ('foo ' );
4342 }
4443
45- public function testAddingMultipleHeaderToResponse ()
44+ public function testAddingMultipleHeaderToResponse (): void
4645 {
47- $ response = new TestResponse (api ()->headers (['foo ' => 'bar ' , 'hello ' => 'world ' , 'invalid header ' ])->respond ());
46+ $ testResponse = new TestResponse (api ()->headers (['foo ' => 'bar ' , 'hello ' => 'world ' , 'invalid header ' ])->respond ());
4847
49- $ response ->assertHeader ('foo ' );
50- $ response ->assertHeader ('hello ' );
51- $ response ->assertHeaderMissing ('invalid header ' );
48+ $ testResponse ->assertHeader ('foo ' );
49+ $ testResponse ->assertHeader ('hello ' );
50+ $ testResponse ->assertHeaderMissing ('invalid header ' );
5251 }
5352}
0 commit comments