@@ -211,56 +211,54 @@ public function testItThrowsWhenFieldsParameterIsNotAStringValue(): void
211211
212212 public function testItCanSpecifyMinimalAttributes (): void
213213 {
214- JsonApiResource::minimalAttributes (function () {
215- $ user = (new BasicModel ([
216- 'id ' => 'user-id ' ,
217- 'name ' => 'user-name ' ,
218- ]));
219- Route::get ('test-route ' , fn () => UserResource::make ($ user ));
214+ JsonApiResource::minimalAttributes ();
215+ $ user = (new BasicModel ([
216+ 'id ' => 'user-id ' ,
217+ 'name ' => 'user-name ' ,
218+ ]));
219+ Route::get ('test-route ' , fn () => UserResource::make ($ user ));
220220
221- $ response = $ this ->getJson ('test-route ' );
221+ $ response = $ this ->getJson ('test-route ' );
222222
223- $ response ->assertOk ();
224- $ response ->assertExactJson ([
225- 'data ' => [
226- 'type ' => 'basicModels ' ,
227- 'id ' => 'user-id ' ,
228- ],
229- 'jsonapi ' => [
230- 'version ' => '1.0 ' ,
231- ],
232- ]);
233- $ this ->assertValidJsonApi ($ response );
234- });
223+ $ response ->assertOk ();
224+ $ response ->assertExactJson ([
225+ 'data ' => [
226+ 'type ' => 'basicModels ' ,
227+ 'id ' => 'user-id ' ,
228+ ],
229+ 'jsonapi ' => [
230+ 'version ' => '1.0 ' ,
231+ ],
232+ ]);
233+ $ this ->assertValidJsonApi ($ response );
235234 }
236235
237236 public function testItCanRequestAttributesWhenUsingMinimalAttributes ()
238237 {
239- JsonApiResource::minimalAttributes (function () {
240- $ user = (new BasicModel ([
241- 'id ' => 'user-id ' ,
242- 'name ' => 'user-name ' ,
243- 'location ' => 'Melbourne ' ,
244- ]));
245- Route::get ('test-route ' , fn () => UserResource::make ($ user ));
238+ JsonApiResource::minimalAttributes ();
239+ $ user = (new BasicModel ([
240+ 'id ' => 'user-id ' ,
241+ 'name ' => 'user-name ' ,
242+ 'location ' => 'Melbourne ' ,
243+ ]));
244+ Route::get ('test-route ' , fn () => UserResource::make ($ user ));
246245
247- $ response = $ this ->getJson ('test-route?fields[basicModels]=name ' );
246+ $ response = $ this ->getJson ('test-route?fields[basicModels]=name ' );
248247
249- $ response ->assertOk ();
250- $ response ->assertExactJson ([
251- 'data ' => [
252- 'type ' => 'basicModels ' ,
253- 'id ' => 'user-id ' ,
254- 'attributes ' => [
255- 'name ' => 'user-name ' ,
256- ],
257- ],
258- 'jsonapi ' => [
259- 'version ' => '1.0 ' ,
248+ $ response ->assertOk ();
249+ $ response ->assertExactJson ([
250+ 'data ' => [
251+ 'type ' => 'basicModels ' ,
252+ 'id ' => 'user-id ' ,
253+ 'attributes ' => [
254+ 'name ' => 'user-name ' ,
260255 ],
261- ]);
262- $ this ->assertValidJsonApi ($ response );
263- });
256+ ],
257+ 'jsonapi ' => [
258+ 'version ' => '1.0 ' ,
259+ ],
260+ ]);
261+ $ this ->assertValidJsonApi ($ response );
264262 }
265263
266264 public function testItCanUseSparseFieldsetsWithIncludedCollections (): void
0 commit comments