Skip to content

Commit 3e6c56c

Browse files
committed
Add test for parsing format 1.1 properties
1 parent ea12636 commit 3e6c56c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/Functional/ParsingTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,17 @@ public function testParseNormativeStatementsForVersion11Correctly(): void
671671
$this->assertCount(6, $document->get('data')->getKeys());
672672
$this->assertCount(188, $document->get('included')->getKeys());
673673
}
674+
675+
public function testParseJsonApiObjectWithVersion11Correctly(): void
676+
{
677+
$string = $this->getJsonString('18_jsonapi_object_with_ext_profile.json');
678+
$document = Parser::parseResponseString($string);
679+
680+
$this->assertInstanceOf('Art4\JsonApiClient\V1\Document', $document);
681+
$this->assertSame(['meta', 'jsonapi'], $document->getKeys());
682+
$this->assertSame(['version'], $document->get('jsonapi')->getKeys());
683+
// TODO: Add support for unknown properties
684+
// $this->assertSame(['version', 'ext', 'profile'], $document->get('jsonapi')->getKeys());
685+
$this->assertSame('1.1', $document->get('jsonapi.version'));
686+
}
674687
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"meta": {},
3+
"jsonapi": {
4+
"version": "1.1",
5+
"ext": [
6+
"https://jsonapi.org/ext/atomic"
7+
],
8+
"profile": [
9+
"http://example.com/profiles/flexible-pagination",
10+
"http://example.com/profiles/resource-versioning"
11+
]
12+
}
13+
}

0 commit comments

Comments
 (0)