@@ -78,6 +78,8 @@ public function is_adds_hasone_relation_in_to_json_api_array()
78
78
$ item = new WithRelationshipItem ();
79
79
$ item ->setId ('1234 ' );
80
80
$ item ->hasoneRelation ()->associate ((new RelatedItem ())->setId ('5678 ' ));
81
+ $ item ->hasoneRelation ()->setLinks (new Links (['self ' => new Link ('http://example.com/articles ' )]));
82
+ $ item ->hasoneRelation ()->setMeta (new Meta (['foo ' => 'bar ' ]));
81
83
82
84
$ this ->assertSame (
83
85
[
@@ -89,6 +91,14 @@ public function is_adds_hasone_relation_in_to_json_api_array()
89
91
'type ' => 'related-item ' ,
90
92
'id ' => '5678 ' ,
91
93
],
94
+ 'links ' => [
95
+ 'self ' => [
96
+ 'href ' => 'http://example.com/articles ' ,
97
+ ],
98
+ ],
99
+ 'meta ' => [
100
+ 'foo ' => 'bar ' ,
101
+ ],
92
102
],
93
103
],
94
104
],
@@ -122,7 +132,7 @@ public function is_adds_empty_hasone_relation_in_to_json_api_array()
122
132
/**
123
133
* @test
124
134
*/
125
- public function is_does_not_add_hasone_relation_without_data_in_to_json_api_array ()
135
+ public function is_does_not_add_hasone_relation_without_data_links_and_meta_in_to_json_api_array ()
126
136
{
127
137
$ item = new WithRelationshipItem ();
128
138
$ item ->setId ('1234 ' );
@@ -145,6 +155,8 @@ public function is_adds_hasmany_relation_in_to_json_api_array()
145
155
$ item = new WithRelationshipItem ();
146
156
$ item ->setId ('1234 ' );
147
157
$ item ->hasmanyRelation ()->associate (new Collection ([(new RelatedItem ())->setId ('5678 ' )]));
158
+ $ item ->hasmanyRelation ()->setLinks (new Links (['self ' => new Link ('http://example.com/articles ' )]));
159
+ $ item ->hasmanyRelation ()->setMeta (new Meta (['foo ' => 'bar ' ]));
148
160
149
161
$ this ->assertSame (
150
162
[
@@ -158,6 +170,14 @@ public function is_adds_hasmany_relation_in_to_json_api_array()
158
170
'id ' => '5678 ' ,
159
171
],
160
172
],
173
+ 'links ' => [
174
+ 'self ' => [
175
+ 'href ' => 'http://example.com/articles ' ,
176
+ ],
177
+ ],
178
+ 'meta ' => [
179
+ 'foo ' => 'bar ' ,
180
+ ],
161
181
],
162
182
],
163
183
],
@@ -191,7 +211,7 @@ public function is_adds_empty_hasmany_relation_in_to_json_api_array()
191
211
/**
192
212
* @test
193
213
*/
194
- public function is_does_not_add_hasmany_relation_without_data_in_to_json_api_array ()
214
+ public function is_does_not_add_hasmany_relation_without_data_links_and_meta_in_to_json_api_array ()
195
215
{
196
216
$ item = new WithRelationshipItem ();
197
217
$ item ->setId ('1234 ' );
@@ -214,6 +234,8 @@ public function is_adds_morphto_relation_in_to_json_api_array()
214
234
$ item = new WithRelationshipItem ();
215
235
$ item ->setId ('1234 ' );
216
236
$ item ->morphtoRelation ()->associate ((new RelatedItem ())->setId ('5678 ' ));
237
+ $ item ->morphtoRelation ()->setLinks (new Links (['self ' => new Link ('http://example.com/articles ' )]));
238
+ $ item ->morphtoRelation ()->setMeta (new Meta (['foo ' => 'bar ' ]));
217
239
218
240
$ this ->assertSame (
219
241
[
@@ -225,6 +247,14 @@ public function is_adds_morphto_relation_in_to_json_api_array()
225
247
'type ' => 'related-item ' ,
226
248
'id ' => '5678 ' ,
227
249
],
250
+ 'links ' => [
251
+ 'self ' => [
252
+ 'href ' => 'http://example.com/articles ' ,
253
+ ],
254
+ ],
255
+ 'meta ' => [
256
+ 'foo ' => 'bar ' ,
257
+ ],
228
258
],
229
259
],
230
260
],
@@ -258,7 +288,7 @@ public function is_adds_empty_morphto_relation_in_to_json_api_array()
258
288
/**
259
289
* @test
260
290
*/
261
- public function is_does_not_add_morphto_relation_without_data_in_to_json_api_array ()
291
+ public function is_does_not_add_morphto_relation_without_data_links_and_meta_in_to_json_api_array ()
262
292
{
263
293
$ item = new WithRelationshipItem ();
264
294
$ item ->setId ('1234 ' );
@@ -281,6 +311,8 @@ public function is_adds_morphtomany_relation_in_to_json_api_array()
281
311
$ item = new WithRelationshipItem ();
282
312
$ item ->setId ('1234 ' );
283
313
$ item ->morphtomanyRelation ()->associate (new Collection ([(new RelatedItem ())->setId ('5678 ' )]));
314
+ $ item ->morphtomanyRelation ()->setLinks (new Links (['self ' => new Link ('http://example.com/articles ' )]));
315
+ $ item ->morphtomanyRelation ()->setMeta (new Meta (['foo ' => 'bar ' ]));
284
316
285
317
$ this ->assertSame (
286
318
[
@@ -294,6 +326,14 @@ public function is_adds_morphtomany_relation_in_to_json_api_array()
294
326
'id ' => '5678 ' ,
295
327
],
296
328
],
329
+ 'links ' => [
330
+ 'self ' => [
331
+ 'href ' => 'http://example.com/articles ' ,
332
+ ],
333
+ ],
334
+ 'meta ' => [
335
+ 'foo ' => 'bar ' ,
336
+ ],
297
337
],
298
338
],
299
339
],
@@ -327,7 +367,7 @@ public function is_adds_empty_morphtomany_relation_in_to_json_api_array()
327
367
/**
328
368
* @test
329
369
*/
330
- public function is_does_not_add_morphtomany_relation_without_data_in_to_json_api_array ()
370
+ public function is_does_not_add_morphtomany_relation_without_data_links_and_meta_in_to_json_api_array ()
331
371
{
332
372
$ item = new WithRelationshipItem ();
333
373
$ item ->setId ('1234 ' );
0 commit comments