5
5
use JsonApiPhp \JsonApi \Attribute ;
6
6
use JsonApiPhp \JsonApi \DataDocument ;
7
7
use JsonApiPhp \JsonApi \JsonApi ;
8
+ use JsonApiPhp \JsonApi \Link \RelatedLink ;
8
9
use JsonApiPhp \JsonApi \Link \SelfLink ;
9
10
use JsonApiPhp \JsonApi \Meta ;
10
11
use JsonApiPhp \JsonApi \ResourceCollection ;
@@ -33,24 +34,23 @@ public function testExtendedDocument()
33
34
'
34
35
{
35
36
"data": [{
36
- "type": "apples ",
37
+ "type": "people ",
37
38
"id": "1",
38
39
"attributes": {
39
- "color": "red",
40
- "sort": "Fuji"
40
+ "name": "Martin Fowler"
41
41
},
42
42
"meta": {"apple_meta": "foo"}
43
43
},{
44
- "type": "apples ",
44
+ "type": "people ",
45
45
"id": "2",
46
46
"attributes": {
47
- "color": "yellow",
48
- "sort": "Gala"
47
+ "name": "Kent Beck"
49
48
},
50
49
"meta": {"apple_meta": "foo"}
51
50
}],
52
51
"links": {
53
- "self": "/apples"
52
+ "self": "/books/123/relationships/authors",
53
+ "related": "/books/123/authors"
54
54
},
55
55
"jsonapi": {
56
56
"version": "1.0"
@@ -61,21 +61,20 @@ public function testExtendedDocument()
61
61
new DataDocument (
62
62
new ResourceCollection (
63
63
new ResourceObject (
64
- 'apples ' ,
64
+ 'people ' ,
65
65
'1 ' ,
66
- new Attribute ('color ' , 'red ' ),
67
- new Attribute ('sort ' , 'Fuji ' ),
66
+ new Attribute ('name ' , 'Martin Fowler ' ),
68
67
new Meta ('apple_meta ' , 'foo ' )
69
68
),
70
69
new ResourceObject (
71
- 'apples ' ,
70
+ 'people ' ,
72
71
'2 ' ,
73
- new Attribute ('color ' , 'yellow ' ),
74
- new Attribute ('sort ' , 'Gala ' ),
72
+ new Attribute ('name ' , 'Kent Beck ' ),
75
73
new Meta ('apple_meta ' , 'foo ' )
76
74
)
77
75
),
78
- new SelfLink ('/apples ' ),
76
+ new SelfLink ('/books/123/relationships/authors ' ),
77
+ new RelatedLink ('/books/123/authors ' ),
79
78
new JsonApi (),
80
79
new Meta ('document_meta ' , 'bar ' )
81
80
)
0 commit comments