@@ -39,12 +39,9 @@ public static function createParserProvider(): array
39
39
}
40
40
41
41
/**
42
- * @test
43
42
* @dataProvider createParserProvider
44
- *
45
- * @param mixed $parser
46
43
*/
47
- public function testParseSimpleResourceWithDifferentParser ($ parser ): void
44
+ public function testParseSimpleResourceWithDifferentParser (callable $ parser ): void
48
45
{
49
46
$ string = $ this ->getJsonString ('01_simple_resource.json ' );
50
47
$ document = $ parser ($ string );
@@ -178,6 +175,7 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
178
175
$ this ->assertTrue ($ document ->has ('included ' ));
179
176
$ this ->assertTrue ($ document ->has ('data ' ));
180
177
178
+ /** @var Accessable */
181
179
$ resources = $ document ->get ('data ' );
182
180
183
181
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceCollection ' , $ resources );
@@ -186,6 +184,8 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
186
184
$ this ->assertSame ($ resources ->getKeys (), [0 ]);
187
185
188
186
$ this ->assertTrue ($ resources ->has (0 ));
187
+
188
+ /** @var Accessable */
189
189
$ resource = $ resources ->get (0 );
190
190
191
191
$ this ->assertFalse ($ resource ->has ('meta ' ));
@@ -195,24 +195,28 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
195
195
$ this ->assertTrue ($ resource ->has ('relationships ' ));
196
196
$ this ->assertTrue ($ resource ->has ('links ' ));
197
197
198
+ /** @var Accessable */
198
199
$ attributes = $ resource ->get ('attributes ' );
199
200
200
201
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\Attributes ' , $ attributes );
201
202
$ this ->assertTrue ($ attributes ->has ('title ' ));
202
203
$ this ->assertSame ($ attributes ->get ('title ' ), 'JSON API paints my bikeshed! ' );
203
204
205
+ /** @var Accessable */
204
206
$ collection = $ resource ->get ('relationships ' );
205
207
206
208
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\RelationshipCollection ' , $ collection );
207
209
$ this ->assertTrue ($ collection ->has ('author ' ));
208
210
$ this ->assertTrue ($ collection ->has ('comments ' ));
209
211
212
+ /** @var Accessable */
210
213
$ author = $ collection ->get ('author ' );
211
214
212
215
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\Relationship ' , $ author );
213
216
$ this ->assertTrue ($ author ->has ('links ' ));
214
217
$ this ->assertTrue ($ author ->has ('data ' ));
215
218
219
+ /** @var Accessable */
216
220
$ links = $ author ->get ('links ' );
217
221
218
222
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\RelationshipLink ' , $ links );
@@ -221,18 +225,21 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
221
225
$ this ->assertTrue ($ links ->has ('related ' ));
222
226
$ this ->assertSame ($ links ->get ('related ' ), 'http://example.com/articles/1/author ' );
223
227
228
+ /** @var Accessable */
224
229
$ data = $ author ->get ('data ' );
225
230
226
231
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceIdentifier ' , $ data );
227
232
$ this ->assertSame ($ data ->get ('type ' ), 'people ' );
228
233
$ this ->assertSame ($ data ->get ('id ' ), '9 ' );
229
234
235
+ /** @var Accessable */
230
236
$ comments = $ collection ->get ('comments ' );
231
237
232
238
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\Relationship ' , $ comments );
233
239
$ this ->assertTrue ($ comments ->has ('links ' ));
234
240
$ this ->assertTrue ($ comments ->has ('data ' ));
235
241
242
+ /** @var Accessable */
236
243
$ links = $ comments ->get ('links ' );
237
244
238
245
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\RelationshipLink ' , $ links );
@@ -241,35 +248,42 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
241
248
$ this ->assertTrue ($ links ->has ('related ' ));
242
249
$ this ->assertSame ($ links ->get ('related ' ), 'http://example.com/articles/1/comments ' );
243
250
251
+ /** @var Accessable */
244
252
$ data_array = $ comments ->get ('data ' );
245
253
246
254
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceIdentifierCollection ' , $ data_array );
247
255
$ this ->assertCount (2 , $ data_array ->getKeys ());
248
256
257
+ /** @var Accessable */
249
258
$ identifier = $ data_array ->get (0 );
250
259
251
260
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceIdentifier ' , $ identifier );
252
261
$ this ->assertSame ($ identifier ->get ('type ' ), 'comments ' );
253
262
$ this ->assertSame ($ identifier ->get ('id ' ), '5 ' );
254
263
264
+ /** @var Accessable */
255
265
$ identifier = $ data_array ->get (1 );
256
266
257
267
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceIdentifier ' , $ identifier );
258
268
$ this ->assertSame ($ identifier ->get ('type ' ), 'comments ' );
259
269
$ this ->assertSame ($ identifier ->get ('id ' ), '12 ' );
260
270
271
+ /** @var Accessable */
261
272
$ links = $ resource ->get ('links ' );
262
273
263
274
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceItemLink ' , $ links );
264
275
$ this ->assertTrue ($ links ->has ('self ' ));
265
276
$ this ->assertSame ($ links ->get ('self ' ), 'http://example.com/articles/1 ' );
266
277
278
+ /** @var Accessable */
267
279
$ includes = $ document ->get ('included ' );
268
280
269
281
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceCollection ' , $ includes );
270
282
$ this ->assertSame ($ includes ->getKeys (), [0 , 1 , 2 ]);
271
283
272
284
$ this ->assertTrue ($ includes ->has (0 ));
285
+
286
+ /** @var Accessable */
273
287
$ include = $ includes ->get (0 );
274
288
275
289
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceItem ' , $ include );
@@ -278,6 +292,7 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
278
292
$ this ->assertTrue ($ include ->has ('attributes ' ));
279
293
$ this ->assertTrue ($ include ->has ('links ' ));
280
294
295
+ /** @var Accessable */
281
296
$ attributes = $ include ->get ('attributes ' );
282
297
283
298
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\Attributes ' , $ attributes );
@@ -288,13 +303,16 @@ public function testParseCompleteResourceObjectWithMultipleRelationships(): void
288
303
$ this ->assertTrue ($ attributes ->has ('twitter ' ));
289
304
$ this ->assertSame ($ attributes ->get ('twitter ' ), 'dgeb ' );
290
305
306
+ /** @var Accessable */
291
307
$ links = $ include ->get ('links ' );
292
308
293
309
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceItemLink ' , $ links );
294
310
$ this ->assertTrue ($ links ->has ('self ' ));
295
311
$ this ->assertSame ($ links ->get ('self ' ), 'http://example.com/people/9 ' );
296
312
297
313
$ this ->assertTrue ($ includes ->has (1 ));
314
+
315
+ /** @var Accessable */
298
316
$ include = $ includes ->get (1 );
299
317
300
318
$ this ->assertInstanceOf ('Art4\JsonApiClient\V1\ResourceItem ' , $ include );
0 commit comments