55use JsonApiPhp \JsonApi \Attribute ;
66use JsonApiPhp \JsonApi \DataDocument ;
77use JsonApiPhp \JsonApi \JsonApi ;
8+ use JsonApiPhp \JsonApi \Link \RelatedLink ;
89use JsonApiPhp \JsonApi \Link \SelfLink ;
910use JsonApiPhp \JsonApi \Meta ;
1011use JsonApiPhp \JsonApi \ResourceCollection ;
@@ -33,24 +34,23 @@ public function testExtendedDocument()
3334 '
3435 {
3536 "data": [{
36- "type": "apples ",
37+ "type": "people ",
3738 "id": "1",
3839 "attributes": {
39- "color": "red",
40- "sort": "Fuji"
40+ "name": "Martin Fowler"
4141 },
4242 "meta": {"apple_meta": "foo"}
4343 },{
44- "type": "apples ",
44+ "type": "people ",
4545 "id": "2",
4646 "attributes": {
47- "color": "yellow",
48- "sort": "Gala"
47+ "name": "Kent Beck"
4948 },
5049 "meta": {"apple_meta": "foo"}
5150 }],
5251 "links": {
53- "self": "/apples"
52+ "self": "/books/123/relationships/authors",
53+ "related": "/books/123/authors"
5454 },
5555 "jsonapi": {
5656 "version": "1.0"
@@ -61,21 +61,20 @@ public function testExtendedDocument()
6161 new DataDocument (
6262 new ResourceCollection (
6363 new ResourceObject (
64- 'apples ' ,
64+ 'people ' ,
6565 '1 ' ,
66- new Attribute ('color ' , 'red ' ),
67- new Attribute ('sort ' , 'Fuji ' ),
66+ new Attribute ('name ' , 'Martin Fowler ' ),
6867 new Meta ('apple_meta ' , 'foo ' )
6968 ),
7069 new ResourceObject (
71- 'apples ' ,
70+ 'people ' ,
7271 '2 ' ,
73- new Attribute ('color ' , 'yellow ' ),
74- new Attribute ('sort ' , 'Gala ' ),
72+ new Attribute ('name ' , 'Kent Beck ' ),
7573 new Meta ('apple_meta ' , 'foo ' )
7674 )
7775 ),
78- new SelfLink ('/apples ' ),
76+ new SelfLink ('/books/123/relationships/authors ' ),
77+ new RelatedLink ('/books/123/authors ' ),
7978 new JsonApi (),
8079 new Meta ('document_meta ' , 'bar ' )
8180 )
0 commit comments