Skip to content

Commit 05c2e91

Browse files
committed
Add spec for JSON:API 1.0, run tests with normative statements
1 parent 593b78e commit 05c2e91

File tree

4 files changed

+4518
-0
lines changed

4 files changed

+4518
-0
lines changed

tests/Functional/ParsingTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,4 +647,16 @@ public function testParseLinksInRelationshipsCorrectly(): void
647647
$this->assertInstanceOf('Art4\JsonApiClient\V1\Document', $document);
648648
$this->assertSame(['data'], $document->getKeys());
649649
}
650+
651+
public function testParseNormativeStatementsForVersion10Correctly(): void
652+
{
653+
$string = $this->getJsonString('format_1.0/normative-statements.json');
654+
$document = Parser::parseResponseString($string);
655+
656+
$this->assertInstanceOf('Art4\JsonApiClient\V1\Document', $document);
657+
$this->assertSame(['data', 'included', 'jsonapi'], $document->getKeys());
658+
$this->assertSame('1.0', $document->get('jsonapi.version'));
659+
$this->assertCount(6, $document->get('data')->getKeys());
660+
$this->assertCount(184, $document->get('included')->getKeys());
661+
}
650662
}

tests/files/format_1.0/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# JSON:API spec version 1.0
2+
3+
Source: https://github.com/json-api/json-api/tree/v1.1/_format/1.0

0 commit comments

Comments
 (0)