@@ -35,10 +35,83 @@ Feature: Cache invalidation through HTTP Cache tags (custom TagCollector service
35
35
Then the response status code should be 201
36
36
And the header "Cache-Tags" should not exist
37
37
38
- Scenario : TagCollector can add cache tags for relations
39
- When I send a "GET" request to "/relation_embedders/2"
38
+ Scenario : TagCollector can add cache tags for relations (JSON-LD format)
39
+ When I add "Accept" header equal to "application/ld+json"
40
+ And I send a "GET" request to "/relation_embedders/2"
40
41
Then the response status code should be 200
41
42
And the header "Cache-Tags" should be equal to "/related_dummies/1#thirdLevel,/related_dummies/1,/RE/2#anotherRelated,/RE/2#related,/RE/2"
43
+ And the JSON should be equal to:
44
+ """
45
+ {
46
+ "@context": "/contexts/RelationEmbedder",
47
+ "@id": "/relation_embedders/2",
48
+ "@type": "RelationEmbedder",
49
+ "krondstadt": "Krondstadt",
50
+ "anotherRelated": {
51
+ "@id": "/related_dummies/1",
52
+ "@type": "https://schema.org/Product",
53
+ "symfony": "symfony",
54
+ "thirdLevel": null
55
+ },
56
+ "related": null
57
+ }
58
+ """
59
+
60
+ Scenario : TagCollector can add cache tags for relations (HAL format)
61
+ When I add "Accept" header equal to "application/hal+json"
62
+ And I send a "GET" request to "/relation_embedders/2"
63
+ Then the response status code should be 200
64
+ And the header "Cache-Tags" should be equal to "/RE/2,/related_dummies/1,/related_dummies/1#thirdLevel,/RE/2#anotherRelated,/RE/2#related"
65
+ And the JSON should be equal to:
66
+ """
67
+ {
68
+ "_links": {
69
+ "self": {
70
+ "href": "/relation_embedders/2"
71
+ },
72
+ "anotherRelated": {
73
+ "href": "/related_dummies/1"
74
+ }
75
+ },
76
+ "_embedded": {
77
+ "anotherRelated": {
78
+ "_links": {
79
+ "self": {
80
+ "href": "/related_dummies/1"
81
+ }
82
+ },
83
+ "symfony": "symfony"
84
+ }
85
+ },
86
+ "krondstadt": "Krondstadt"
87
+ }
88
+ """
89
+
90
+ Scenario : TagCollector can add cache tags for relations (JSONAPI format)
91
+ When I add "Accept" header equal to "application/vnd.api+json"
92
+ And I send a "GET" request to "/relation_embedders/2"
93
+ Then the response status code should be 200
94
+ And the header "Cache-Tags" should be equal to "/RE/2,/RE/2#anotherRelated,/RE/2#related"
95
+ And the JSON should be equal to:
96
+ """
97
+ {
98
+ "data": {
99
+ "id": "/relation_embedders/2",
100
+ "type": "RelationEmbedder",
101
+ "attributes": {
102
+ "krondstadt": "Krondstadt"
103
+ },
104
+ "relationships": {
105
+ "anotherRelated": {
106
+ "data": {
107
+ "type": "RelatedDummy",
108
+ "id": "/related_dummies/1"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ """
42
115
43
116
Scenario : Create resource with extraProperties on ApiProperty
44
117
When I add "Content-Type" header equal to "application/ld+json"
@@ -54,3 +127,139 @@ Feature: Cache invalidation through HTTP Cache tags (custom TagCollector service
54
127
When I send a "GET" request to "/extra_properties_on_properties/1"
55
128
Then the response status code should be 200
56
129
And the header "Cache-Tags" should be equal to "/extra_properties_on_properties/1#overrideRelationTag,/extra_properties_on_properties/1"
130
+
131
+ Scenario : Create two Relation2
132
+ When I add "Content-Type" header equal to "application/ld+json"
133
+ And I send a "POST" request to "/relation2s" with body:
134
+ """
135
+ {
136
+ }
137
+ """
138
+ When I add "Content-Type" header equal to "application/ld+json"
139
+ And I send a "POST" request to "/relation2s" with body:
140
+ """
141
+ {
142
+ }
143
+ """
144
+ Then the response status code should be 201
145
+
146
+ Scenario : Create a Relation3 with many to many
147
+ When I add "Content-Type" header equal to "application/ld+json"
148
+ And I send a "POST" request to "/relation3s" with body:
149
+ """
150
+ {
151
+ "relation2s": ["/relation2s/1", "/relation2s/2"]
152
+ }
153
+ """
154
+ Then the response status code should be 201
155
+
156
+ Scenario : Get a Relation3 (test collection of links; JSON-LD format)
157
+ When I add "Accept" header equal to "application/ld+json"
158
+ And I send a "GET" request to "/relation3s"
159
+ Then the response status code should be 200
160
+ And the header "Cache-Tags" should be equal to "/relation3s/1#relation2s,/relation3s/1,/relation3s"
161
+ And the JSON should be equal to:
162
+ """
163
+ {
164
+ "@context": "/contexts/Relation3",
165
+ "@id": "/relation3s",
166
+ "@type": "hydra:Collection",
167
+ "hydra:totalItems": 1,
168
+ "hydra:member": [
169
+ {
170
+ "@id": "/relation3s/1",
171
+ "@type": "Relation3",
172
+ "id": 1,
173
+ "relation2s": [
174
+ "/relation2s/1",
175
+ "/relation2s/2"
176
+ ]
177
+ }
178
+ ]
179
+ }
180
+ """
181
+
182
+ Scenario : Get a Relation3 (test collection of links; HAL format)
183
+ When I add "Accept" header equal to "application/hal+json"
184
+ And I send a "GET" request to "/relation3s"
185
+ Then the response status code should be 200
186
+ And the header "Cache-Tags" should be equal to "/relation3s/1,/relation3s/1#relation2s,/relation3s"
187
+ And the JSON should be equal to:
188
+ """
189
+ {
190
+ "_links": {
191
+ "self": {
192
+ "href": "/relation3s"
193
+ },
194
+ "item": [
195
+ {
196
+ "href": "/relation3s/1"
197
+ }
198
+ ]
199
+ },
200
+ "totalItems": 1,
201
+ "itemsPerPage": 3,
202
+ "_embedded": {
203
+ "item": [
204
+ {
205
+ "_links": {
206
+ "self": {
207
+ "href": "/relation3s/1"
208
+ },
209
+ "relation2s": [
210
+ {
211
+ "href": "/relation2s/1"
212
+ },
213
+ {
214
+ "href": "/relation2s/2"
215
+ }
216
+ ]
217
+ },
218
+ "id": 1
219
+ }
220
+ ]
221
+ }
222
+ }
223
+ """
224
+
225
+ Scenario : Get a Relation3 (test collection of links; HAL format)
226
+ When I add "Accept" header equal to "application/vnd.api+json"
227
+ And I send a "GET" request to "/relation3s"
228
+ Then the response status code should be 200
229
+ And the header "Cache-Tags" should be equal to "/relation3s/1,/relation3s/1#relation2s,/relation3s"
230
+ And the JSON should be equal to:
231
+ """
232
+ {
233
+ "links": {
234
+ "self": "/relation3s"
235
+ },
236
+ "meta": {
237
+ "totalItems": 1,
238
+ "itemsPerPage": 3,
239
+ "currentPage": 1
240
+ },
241
+ "data": [
242
+ {
243
+ "id": "/relation3s/1",
244
+ "type": "Relation3",
245
+ "attributes": {
246
+ "_id": 1
247
+ },
248
+ "relationships": {
249
+ "relation2s": {
250
+ "data": [
251
+ {
252
+ "type": "Relation2",
253
+ "id": "/relation2s/1"
254
+ },
255
+ {
256
+ "type": "Relation2",
257
+ "id": "/relation2s/2"
258
+ }
259
+ ]
260
+ }
261
+ }
262
+ }
263
+ ]
264
+ }
265
+ """
0 commit comments