@@ -193,45 +193,45 @@ Feature: Subresource support
193
193
}
194
194
"""
195
195
196
- # Scenario: Get the subresource relation item
197
- # When I send a "GET" request to "/dummies/1/related_dummies/2"
198
- # Then the response status code should be 200
199
- # And the response should be in JSON
200
- # And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
201
- # And the JSON should be equal to:
202
- # """
203
- # {
204
- # "@context": "/contexts/RelatedDummy",
205
- # "@id": "/related_dummies/2",
206
- # "@type": "https://schema.org/Product",
207
- # "id": 2,
208
- # "name": null,
209
- # "symfony": "symfony",
210
- # "dummyDate": null,
211
- # "thirdLevel": {
212
- # "@id": "/third_levels/1",
213
- # "@type": "ThirdLevel",
214
- # "fourthLevel": "/fourth_levels/1"
215
- # },
216
- # "relatedToDummyFriend": [],
217
- # "dummyBoolean": null,
218
- # "embeddedDummy": [],
219
- # "age": null
220
- # }
221
- # """
196
+ Scenario : Get the subresource relation item
197
+ When I send a "GET" request to "/dummies/1/related_dummies/2"
198
+ Then the response status code should be 200
199
+ And the response should be in JSON
200
+ And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
201
+ And the JSON should be equal to:
202
+ """
203
+ {
204
+ "@context": "/contexts/RelatedDummy",
205
+ "@id": "/related_dummies/2",
206
+ "@type": "https://schema.org/Product",
207
+ "id": 2,
208
+ "name": null,
209
+ "symfony": "symfony",
210
+ "dummyDate": null,
211
+ "thirdLevel": {
212
+ "@id": "/third_levels/1",
213
+ "@type": "ThirdLevel",
214
+ "fourthLevel": "/fourth_levels/1"
215
+ },
216
+ "relatedToDummyFriend": [],
217
+ "dummyBoolean": null,
218
+ "embeddedDummy": [],
219
+ "age": null
220
+ }
221
+ """
222
222
223
- # Scenario: Create a dummy with a relation that is a subresource
224
- # When I add "Content-Type" header equal to "application/ld+json"
225
- # And I send a "POST" request to "/dummies" with body:
226
- # """
227
- # {
228
- # "name": "Dummy with relations",
229
- # "relatedDummy": "/dummies/1/related_dummies/2"
230
- # }
231
- # """
232
- # Then the response status code should be 201
233
- # And the response should be in JSON
234
- # And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
223
+ Scenario : Create a dummy with a relation that is a subresource
224
+ When I add "Content-Type" header equal to "application/ld+json"
225
+ And I send a "POST" request to "/dummies" with body:
226
+ """
227
+ {
228
+ "name": "Dummy with relations",
229
+ "relatedDummy": "/dummies/1/related_dummies/2"
230
+ }
231
+ """
232
+ Then the response status code should be 201
233
+ And the response should be in JSON
234
+ And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
235
235
236
236
Scenario : Get the embedded relation subresource item at the third level
237
237
When I send a "GET" request to "/dummies/1/related_dummies/1/third_level"
@@ -344,7 +344,30 @@ Feature: Subresource support
344
344
}
345
345
"""
346
346
347
+ Scenario : Recursive resource
348
+ When I send a "GET" request to "/dummy_products/2"
349
+ Then the response status code should be 200
350
+ And the response should be in JSON
351
+ And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
352
+ And the JSON should be equal to:
353
+ """
354
+ {
355
+ "@context": "/contexts/DummyProduct",
356
+ "@id": "/dummy_products/2",
357
+ "@type": "DummyProduct",
358
+ "offers": [
359
+ "/dummy_aggregate_offers/1"
360
+ ],
361
+ "id": 2,
362
+ "name": "Dummy product",
363
+ "relatedProducts": [
364
+ "/dummy_products/1"
365
+ ],
366
+ "parent": null
367
+ }
368
+ """
347
369
370
+ @createSchema
348
371
Scenario : The OneToOne subresource should be accessible from owned side
349
372
Given there is a RelatedOwnedDummy object with OneToOne relation
350
373
When I send a "GET" request to "/related_owned_dummies/1/owning_dummy"
@@ -355,7 +378,7 @@ Feature: Subresource support
355
378
"""
356
379
{
357
380
"@context": "/contexts/Dummy",
358
- "@id": "/dummies/2 ",
381
+ "@id": "/dummies/1 ",
359
382
"@type": "Dummy",
360
383
"description": null,
361
384
"dummy": null,
@@ -370,13 +393,14 @@ Feature: Subresource support
370
393
"name_converted": null,
371
394
"relatedOwnedDummy": "/related_owned_dummies/1",
372
395
"relatedOwningDummy": null,
373
- "id": 2 ,
396
+ "id": 1 ,
374
397
"name": "plop",
375
398
"alias": null,
376
399
"foo": null
377
400
}
378
401
"""
379
402
403
+ @createSchema
380
404
Scenario : The OneToOne subresource should be accessible from owning side
381
405
Given there is a RelatedOwningDummy object with OneToOne relation
382
406
When I send a "GET" request to "/related_owning_dummies/1/owned_dummy"
@@ -387,7 +411,7 @@ Feature: Subresource support
387
411
"""
388
412
{
389
413
"@context": "/contexts/Dummy",
390
- "@id": "/dummies/3 ",
414
+ "@id": "/dummies/1 ",
391
415
"@type": "Dummy",
392
416
"description": null,
393
417
"dummy": null,
@@ -402,32 +426,9 @@ Feature: Subresource support
402
426
"name_converted": null,
403
427
"relatedOwnedDummy": null,
404
428
"relatedOwningDummy": "/related_owning_dummies/1",
405
- "id": 3 ,
429
+ "id": 1 ,
406
430
"name": "plop",
407
431
"alias": null,
408
432
"foo": null
409
433
}
410
434
"""
411
-
412
- Scenario : Recursive resource
413
- When I send a "GET" request to "/dummy_products/2"
414
- Then the response status code should be 200
415
- And the response should be in JSON
416
- And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
417
- And the JSON should be equal to:
418
- """
419
- {
420
- "@context": "/contexts/DummyProduct",
421
- "@id": "/dummy_products/2",
422
- "@type": "DummyProduct",
423
- "offers": [
424
- "/dummy_aggregate_offers/1"
425
- ],
426
- "id": 2,
427
- "name": "Dummy product",
428
- "relatedProducts": [
429
- "/dummy_products/1"
430
- ],
431
- "parent": null
432
- }
433
- """
0 commit comments