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
test relations with writable constructor parameters
implement constructor params relation denormalization
drop identifier getter typehint because of doctrine listeners problem
tests for cyclic relationship
drop constructor cycle deps (impossible to handle), add iri and nullable param test
test put method
remove return types from test entities to pass low deps test
fix cs
fix phpstan
adjust to changes in symfony/serializer PR
I need to be able to use class without setters as ApiResource
5
+
6
+
@createSchema
7
+
Scenario: Create Value object resource
8
+
When I add "Content-Type" header equal to "application/ld+json"
9
+
And I send a "POST" request to "/vo_dummy_cars" with body:
10
+
"""
11
+
{
12
+
"mileage": 1500,
13
+
"bodyType": "suv",
14
+
"make": "CustomCar",
15
+
"insuranceCompany": {
16
+
"name": "Safe Drive Company"
17
+
},
18
+
"drivers": [
19
+
{
20
+
"firstName": "John",
21
+
"lastName": "Doe"
22
+
}
23
+
]
24
+
}
25
+
"""
26
+
Then the response status code should be 201
27
+
And the JSON should be equal to:
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
+
}
51
+
"""
52
+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
53
+
54
+
Scenario: Create Value object with IRI and nullable parameter
55
+
When I add "Content-Type" header equal to "application/ld+json"
56
+
And I send a "POST" request to "/vo_dummy_inspections" with body:
57
+
"""
58
+
{
59
+
"accepted": true,
60
+
"car": "/vo_dummy_cars/1"
61
+
}
62
+
"""
63
+
Then the response status code should be 201
64
+
And the JSON should be valid according to this schema:
65
+
"""
66
+
{
67
+
"type": "object",
68
+
"required": ["accepted", "performed", "car"],
69
+
"properties": {
70
+
"accepted": {
71
+
"enum":[true]
72
+
},
73
+
"performed": {
74
+
"format": "date-time"
75
+
},
76
+
"car": {
77
+
"enum": ["/vo_dummy_cars/1"]
78
+
}
79
+
}
80
+
}
81
+
"""
82
+
83
+
Scenario: Update Value object with writable and non writable property
84
+
When I add "Content-Type" header equal to "application/ld+json"
85
+
And I send a "PUT" request to "/vo_dummy_inspections/1" with body:
86
+
"""
87
+
{
88
+
"performed": "2018-08-24 00:00:00",
89
+
"accepted": false
90
+
}
91
+
"""
92
+
Then the response status code should be 200
93
+
And the JSON should be equal to:
94
+
"""
95
+
{
96
+
"@context": "/contexts/VoDummyInspection",
97
+
"@id": "/vo_dummy_inspections/1",
98
+
"@type": "VoDummyInspection",
99
+
"accepted": true,
100
+
"car": "/vo_dummy_cars/1",
101
+
"performed": "2018-08-24T00:00:00+00:00",
102
+
"id": 1
103
+
}
104
+
"""
105
+
106
+
@createSchema
107
+
Scenario: Create Value object without required params
108
+
When I add "Content-Type" header equal to "application/ld+json"
109
+
And I send a "POST" request to "/vo_dummy_cars" with body:
110
+
"""
111
+
{
112
+
"mileage": 1500,
113
+
"make": "CustomCar",
114
+
"insuranceCompany": {
115
+
"name": "Safe Drive Company"
116
+
}
117
+
}
118
+
"""
119
+
Then the response status code should be 400
120
+
And the JSON should be valid according to this schema:
121
+
"""
122
+
{
123
+
"type": "object",
124
+
"properties": {
125
+
"@context": {
126
+
"enum": ["/contexts/Error"]
127
+
},
128
+
"type": {
129
+
"enum": ["hydra:Error"]
130
+
},
131
+
"hydra:title": {
132
+
"enum": ["An error occurred"]
133
+
},
134
+
"hydra:description": {
135
+
"enum": ["Cannot create an instance of ApiPlatform\\Core\\Tests\\Fixtures\\TestBundle\\Entity\\VoDummyCar from serialized data because its constructor requires parameter \"drivers\" to be present."]
136
+
}
137
+
}
138
+
}
139
+
"""
140
+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
141
+
142
+
@createSchema
143
+
Scenario: Create Value object without default param
144
+
When I add "Content-Type" header equal to "application/ld+json"
145
+
And I send a "POST" request to "/vo_dummy_cars" with body:
146
+
"""
147
+
{
148
+
"mileage": 1500,
149
+
"make": "CustomCar",
150
+
"insuranceCompany": {
151
+
"name": "Safe Drive Company"
152
+
},
153
+
"drivers": [
154
+
{
155
+
"firstName": "John",
156
+
"lastName": "Doe"
157
+
}
158
+
]
159
+
}
160
+
"""
161
+
Then the response status code should be 201
162
+
And the JSON should be equal to:
163
+
"""
164
+
{
165
+
"@context": "/contexts/VoDummyCar",
166
+
"@id": "/vo_dummy_cars/1",
167
+
"@type": "VoDummyCar",
168
+
"mileage": 1500,
169
+
"bodyType": "coupe",
170
+
"inspections": [],
171
+
"make": "CustomCar",
172
+
"insuranceCompany": {
173
+
"@id": "/vo_dummy_insurance_companies/1",
174
+
"@type": "VoDummyInsuranceCompany",
175
+
"name": "Safe Drive Company"
176
+
},
177
+
"drivers": [
178
+
{
179
+
"@id": "/vo_dummy_drivers/1",
180
+
"@type": "VoDummyDriver",
181
+
"firstName": "John",
182
+
"lastName": "Doe"
183
+
}
184
+
]
185
+
}
186
+
"""
187
+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
if ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) {
173
+
if (!\is_array($data[$paramName])) {
174
+
thrownewRuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name));
0 commit comments