Skip to content

Commit 53468c0

Browse files
committed
Fix schema and parser test
1 parent 9dd8d46 commit 53468c0

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

tests/Data/CommentSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getRelationships($comment, array $includeRelationships = [])
5353
{
5454
assert('$comment instanceof '.Comment::class);
5555

56-
if (isset($includeRelationships[Comment::LINK_AUTHOR]) === false) {
56+
if (isset($includeRelationships[Comment::LINK_AUTHOR]) === true) {
5757
$data = $comment->{Comment::LINK_AUTHOR};
5858
} else {
5959
// issue #75 https://github.com/neomerx/json-api/issues/75

tests/Encoder/Parser/ParserTest.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ class ParserTest extends BaseTestCase
6565
*/
6666
private $authorAttr;
6767

68+
/**
69+
* @var array
70+
*/
71+
private $authorAttrNull;
72+
6873
/**
6974
* @var array
7075
*/
@@ -132,6 +137,11 @@ protected function setUp()
132137
Author::ATTRIBUTE_LAST_NAME => $this->author->{Author::ATTRIBUTE_LAST_NAME},
133138
];
134139

140+
$this->authorAttrNull = [
141+
Author::ATTRIBUTE_FIRST_NAME => null,
142+
Author::ATTRIBUTE_LAST_NAME => null,
143+
];
144+
135145
$this->commAttr5 = [
136146
Comment::ATTRIBUTE_BODY => $this->comments[0]->{Comment::ATTRIBUTE_BODY},
137147
];
@@ -204,15 +214,15 @@ public function testParseObjectWithCircularReferences()
204214
$start = ParserReplyInterface::REPLY_TYPE_RESOURCE_STARTED;
205215
$complete = ParserReplyInterface::REPLY_TYPE_RESOURCE_COMPLETED;
206216
$expected = [
207-
// level link name type id attributes meta
208-
[$start, 1, '', 'people', 9, $this->authorAttr, null],
209-
[$start, 2, 'comments', 'comments', 5, $this->commAttr5, null],
210-
[$start, 3, 'author', 'people', 9, $this->authorAttr, null],
211-
[$complete, 2, 'comments', 'comments', 5, $this->commAttr5, null],
212-
[$start, 2, 'comments', 'comments', 12, $this->commAttr12, null],
213-
[$start, 3, 'author', 'people', 9, $this->authorAttr, null],
214-
[$complete, 2, 'comments', 'comments', 12, $this->commAttr12, null],
215-
[$complete, 1, '', 'people', 9, $this->authorAttr, null],
217+
// level link name type id attributes meta
218+
[$start, 1, '', 'people', 9, $this->authorAttr, null],
219+
[$start, 2, 'comments', 'comments', 5, $this->commAttr5, null],
220+
[$start, 3, 'author', 'people', 9, $this->authorAttrNull, null],
221+
[$complete, 2, 'comments', 'comments', 5, $this->commAttr5, null],
222+
[$start, 2, 'comments', 'comments', 12, $this->commAttr12, null],
223+
[$start, 3, 'author', 'people', 9, $this->authorAttrNull, null],
224+
[$complete, 2, 'comments', 'comments', 12, $this->commAttr12, null],
225+
[$complete, 1, '', 'people', 9, $this->authorAttr, null],
216226
];
217227

218228
$allReplies = [];

0 commit comments

Comments
 (0)