You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/main/relation.feature
+31-5Lines changed: 31 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -491,7 +491,7 @@ Feature: Relations support
491
491
Given there are people having pets
492
492
When I add "Content-Type" header equal to "application/ld+json"
493
493
And I send a "GET" request to "/people"
494
-
Andthe response status code should be 200
494
+
Thenthe response status code should be 200
495
495
And the response should be in JSON
496
496
And the JSON should be equal to:
497
497
"""
@@ -621,8 +621,6 @@ Feature: Relations support
621
621
}
622
622
"""
623
623
624
-
625
-
@dropSchema
626
624
Scenario: Passing an invalid IRI to a relation
627
625
When I add "Content-Type" header equal to "application/ld+json"
628
626
And I send a "POST" request to "/relation_embedders" with body:
@@ -634,7 +632,7 @@ Feature: Relations support
634
632
Then the response status code should be 400
635
633
And the response should be in JSON
636
634
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
637
-
And the JSON node "hydra:description" should contain "Invalid value provided (invalid IRI?)."
635
+
And the JSON node "hydra:description" should contain 'Invalid IRI "certainly not an iri and not a plain identifier".'
638
636
639
637
Scenario: Passing an invalid type to a relation
640
638
When I add "Content-Type" header equal to "application/ld+json"
@@ -647,4 +645,32 @@ Feature: Relations support
647
645
Then the response status code should be 400
648
646
And the response should be in JSON
649
647
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
650
-
And the JSON node "hydra:description" should contain "Invalid value provided (invalid IRI?)."
648
+
And the JSON should be valid according to this schema:
649
+
"""
650
+
{
651
+
"type": "object",
652
+
"properties": {
653
+
"@context": {
654
+
"type": "string",
655
+
"pattern": "^/contexts/Error$"
656
+
},
657
+
"@type": {
658
+
"type": "string",
659
+
"pattern": "^hydra:Error$"
660
+
},
661
+
"hydra:title": {
662
+
"type": "string",
663
+
"pattern": "^An error occurred$"
664
+
},
665
+
"hydra:description": {
666
+
"pattern": "^Expected IRI or document for resource \"ApiPlatform\\\\Core\\\\Tests\\\\Fixtures\\\\TestBundle\\\\(Document|Entity)\\\\RelatedDummy\", \"integer\" given.$"
Copy file name to clipboardExpand all lines: features/serializer/vo_relations.feature
+38-30Lines changed: 38 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -26,28 +26,28 @@ Feature: Value object as ApiResource
26
26
Then the response status code should be 201
27
27
And the JSON should be equal to:
28
28
"""
29
-
{
30
-
"@context": "/contexts/VoDummyCar",
31
-
"@id": "/vo_dummy_cars/1",
32
-
"@type": "VoDummyCar",
33
-
"mileage": 1500,
34
-
"bodyType": "suv",
35
-
"inspections": [],
36
-
"make": "CustomCar",
37
-
"insuranceCompany": {
38
-
"@id": "/vo_dummy_insurance_companies/1",
39
-
"@type": "VoDummyInsuranceCompany",
40
-
"name": "Safe Drive Company"
41
-
},
42
-
"drivers": [
43
-
{
44
-
"@id": "/vo_dummy_drivers/1",
45
-
"@type": "VoDummyDriver",
46
-
"firstName": "John",
47
-
"lastName": "Doe"
48
-
}
49
-
]
50
-
}
29
+
{
30
+
"@context": "/contexts/VoDummyCar",
31
+
"@id": "/vo_dummy_cars/1",
32
+
"@type": "VoDummyCar",
33
+
"mileage": 1500,
34
+
"bodyType": "suv",
35
+
"inspections": [],
36
+
"make": "CustomCar",
37
+
"insuranceCompany": {
38
+
"@id": "/vo_dummy_insurance_companies/1",
39
+
"@type": "VoDummyInsuranceCompany",
40
+
"name": "Safe Drive Company"
41
+
},
42
+
"drivers": [
43
+
{
44
+
"@id": "/vo_dummy_drivers/1",
45
+
"@type": "VoDummyDriver",
46
+
"firstName": "John",
47
+
"lastName": "Doe"
48
+
}
49
+
]
50
+
}
51
51
"""
52
52
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
53
53
@@ -98,8 +98,7 @@ Feature: Value object as ApiResource
98
98
"@type": "VoDummyInspection",
99
99
"accepted": true,
100
100
"car": "/vo_dummy_cars/1",
101
-
"performed": "2018-08-24T00:00:00+00:00",
102
-
"id": 1
101
+
"performed": "2018-08-24T00:00:00+00:00"
103
102
}
104
103
"""
105
104
@@ -117,27 +116,36 @@ Feature: Value object as ApiResource
117
116
}
118
117
"""
119
118
Then the response status code should be 400
119
+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
120
120
And the JSON should be valid according to this schema:
121
121
"""
122
122
{
123
123
"type": "object",
124
124
"properties": {
125
125
"@context": {
126
-
"enum": ["/contexts/Error"]
126
+
"type": "string",
127
+
"pattern": "^/contexts/Error$"
127
128
},
128
-
"type": {
129
-
"enum": ["hydra:Error"]
129
+
"@type": {
130
+
"type": "string",
131
+
"pattern": "^hydra:Error$"
130
132
},
131
133
"hydra:title": {
132
-
"enum": ["An error occurred"]
134
+
"type": "string",
135
+
"pattern": "^An error occurred$"
133
136
},
134
137
"hydra:description": {
135
138
"pattern": "^Cannot create an instance of ApiPlatform\\\\Core\\\\Tests\\\\Fixtures\\\\TestBundle\\\\(Document|Entity)\\\\VoDummyCar from serialized data because its constructor requires parameter \"drivers\" to be present.$"
136
139
}
137
-
}
140
+
},
141
+
"required": [
142
+
"@context",
143
+
"@type",
144
+
"hydra:title",
145
+
"hydra:description"
146
+
]
138
147
}
139
148
"""
140
-
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
141
149
142
150
@createSchema
143
151
Scenario: Create Value object without default param
0 commit comments