Skip to content

Commit d059897

Browse files
committed
test case with href in relationship added
refs #57
1 parent 95c6160 commit d059897

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/Integration/ParsingTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
}

0 commit comments

Comments
 (0)