|
| 1 | +Feature: Nesting resources |
| 2 | + In order to retrieve a tree of data |
| 3 | + As a webservice user |
| 4 | + I need to be able to get nested resources |
| 5 | + |
| 6 | + Background: |
| 7 | + Given the test application has the following configuration: |
| 8 | + """ |
| 9 | + cmf_resource: |
| 10 | + repositories: |
| 11 | + default: |
| 12 | + type: doctrine_phpcr_odm |
| 13 | + basepath: /tests/cmf/articles |
| 14 | + """ |
| 15 | + And there exists an "Article" document at "/cmf/articles/foo": |
| 16 | + | title | Article 1 | |
| 17 | + | body | This is my article | |
| 18 | + And there exists an "Article" document at "/cmf/articles/foo/sub": |
| 19 | + | title | Sub-article 1 | |
| 20 | + | body | This is my article | |
| 21 | + |
| 22 | + Scenario: Retrieving nested resources |
| 23 | + When I send a GET request to "/api/default/foo" |
| 24 | + Then the response should contain json: |
| 25 | + """ |
| 26 | + { |
| 27 | + "repository_alias": "default", |
| 28 | + "repository_type": "doctrine_phpcr_odm", |
| 29 | + "payload_alias": null, |
| 30 | + "payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article", |
| 31 | + "path": "\/foo", |
| 32 | + "node_name": "foo", |
| 33 | + "label": "foo", |
| 34 | + "repository_path": "\/foo", |
| 35 | + "children": { |
| 36 | + "sub": { |
| 37 | + "repository_alias": "default", |
| 38 | + "repository_type": "doctrine_phpcr_odm", |
| 39 | + "payload_alias": null, |
| 40 | + "payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article", |
| 41 | + "path": "\/foo\/sub", |
| 42 | + "node_name": "sub", |
| 43 | + "label": "sub", |
| 44 | + "repository_path": "\/foo\/sub", |
| 45 | + "children": [] |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + """ |
| 50 | + |
| 51 | + Scenario: Specifying a depth |
| 52 | + When I send a GET request to "/api/default/foo?depth=0" |
| 53 | + Then the response should contain json: |
| 54 | + """ |
| 55 | + { |
| 56 | + "repository_alias": "default", |
| 57 | + "repository_type": "doctrine_phpcr_odm", |
| 58 | + "payload_alias": null, |
| 59 | + "payload_type": "Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\Article", |
| 60 | + "path": "\/foo", |
| 61 | + "node_name": "foo", |
| 62 | + "label": "foo", |
| 63 | + "repository_path": "\/foo", |
| 64 | + "children": { |
| 65 | + "sub": [] |
| 66 | + } |
| 67 | + } |
| 68 | + """ |
0 commit comments