File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -665,4 +665,19 @@ public function testParseIdAsInteger()
665665 // Test full array
666666 $ this ->assertEquals (json_decode ($ string , true ), $ document ->asArray (true ));
667667 }
668+
669+ /**
670+ * @test
671+ */
672+ public function testParseLinksInRelationshipsCorrectly ()
673+ {
674+ $ string = $ this ->getJsonString ('17_relationship_links.json ' );
675+ $ document = Helper::parseResponseBody ($ string );
676+
677+ $ this ->assertInstanceOf ('Art4\JsonApiClient\Document ' , $ document );
678+ $ this ->assertSame (['data ' ], $ document ->getKeys ());
679+
680+ // Test full array
681+ $ this ->assertEquals (json_decode ($ string , true ), $ document ->asArray (true ));
682+ }
668683}
Original file line number Diff line number Diff line change 1+ {
2+ "data" : [
3+ {
4+ "type" : " articles" ,
5+ "id" : " 1" ,
6+ "attributes" : {
7+ "title" : " JSON API paints my bikeshed!"
8+ },
9+ "relationships" : {
10+ "vid" : {
11+ "data" : {
12+ "type" : " taxonomy_vocabulary--taxonomy_vocabulary" ,
13+ "id" : " e0b18172-b9fa-4a2f-88c0-ed19dca65a1b"
14+ },
15+ "links" : {
16+ "self" : {
17+ "href" : " */jsonapi/taxonomy_term/district/3fa7e3cd-ce96-4be7-abac-7203bf8a9f4f/relationships/vid"
18+ },
19+ "related" : {
20+ "href" : " */jsonapi/taxonomy_term/district/3fa7e3cd-ce96-4be7-abac-7203bf8a9f4f/vid"
21+ }
22+ }
23+ }
24+ }
25+ }
26+ ]
27+ }
You can’t perform that action at this time.
0 commit comments