|
24 | 24 | use ApiPlatform\Metadata\Operations;
|
25 | 25 | use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
|
26 | 26 | use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
|
27 |
| -use DomainException; |
28 | 27 | use PHPUnit\Framework\TestCase;
|
29 | 28 | use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
|
30 | 29 | use Symfony\Component\Debug\Exception\FlattenException as LegacyFlattenException;
|
@@ -82,7 +81,7 @@ public function testLegacyActionWithOperationExceptionToStatus(
|
82 | 81 | ) {
|
83 | 82 | $this->expectDeprecation('Since api-platform/core 2.7: Use "ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface" instead of "ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface".');
|
84 | 83 |
|
85 |
| - $exception = new DomainException(); |
| 84 | + $exception = new \DomainException(); |
86 | 85 | $flattenException = FlattenException::create($exception);
|
87 | 86 |
|
88 | 87 | $serializer = $this->prophesize(SerializerInterface::class);
|
@@ -135,7 +134,7 @@ public function testActionWithOperationExceptionToStatus(
|
135 | 134 | ?array $operationExceptionToStatus,
|
136 | 135 | int $expectedStatusCode
|
137 | 136 | ) {
|
138 |
| - $exception = new DomainException(); |
| 137 | + $exception = new \DomainException(); |
139 | 138 | $flattenException = FlattenException::create($exception);
|
140 | 139 |
|
141 | 140 | $serializer = $this->prophesize(SerializerInterface::class);
|
@@ -196,86 +195,86 @@ public function provideOperationExceptionToStatusCases()
|
196 | 195 | ];
|
197 | 196 |
|
198 | 197 | yield 'on global attributes' => [
|
199 |
| - [DomainException::class => 100], |
| 198 | + [\DomainException::class => 100], |
200 | 199 | null,
|
201 | 200 | null,
|
202 | 201 | 100,
|
203 | 202 | ];
|
204 | 203 |
|
205 | 204 | yield 'on global attributes with empty resource and operation attributes' => [
|
206 |
| - [DomainException::class => 100], |
| 205 | + [\DomainException::class => 100], |
207 | 206 | [],
|
208 | 207 | [],
|
209 | 208 | 100,
|
210 | 209 | ];
|
211 | 210 |
|
212 | 211 | yield 'on global attributes and resource attributes' => [
|
213 |
| - [DomainException::class => 100], |
214 |
| - [DomainException::class => 200], |
| 212 | + [\DomainException::class => 100], |
| 213 | + [\DomainException::class => 200], |
215 | 214 | null,
|
216 | 215 | 200,
|
217 | 216 | ];
|
218 | 217 |
|
219 | 218 | yield 'on global attributes and resource attributes with empty operation attributes' => [
|
220 |
| - [DomainException::class => 100], |
221 |
| - [DomainException::class => 200], |
| 219 | + [\DomainException::class => 100], |
| 220 | + [\DomainException::class => 200], |
222 | 221 | [],
|
223 | 222 | 200,
|
224 | 223 | ];
|
225 | 224 |
|
226 | 225 | yield 'on global attributes and operation attributes' => [
|
227 |
| - [DomainException::class => 100], |
| 226 | + [\DomainException::class => 100], |
228 | 227 | null,
|
229 |
| - [DomainException::class => 300], |
| 228 | + [\DomainException::class => 300], |
230 | 229 | 300,
|
231 | 230 | ];
|
232 | 231 |
|
233 | 232 | yield 'on global attributes and operation attributes with empty resource attributes' => [
|
234 |
| - [DomainException::class => 100], |
| 233 | + [\DomainException::class => 100], |
235 | 234 | [],
|
236 |
| - [DomainException::class => 300], |
| 235 | + [\DomainException::class => 300], |
237 | 236 | 300,
|
238 | 237 | ];
|
239 | 238 |
|
240 | 239 | yield 'on global, resource and operation attributes' => [
|
241 |
| - [DomainException::class => 100], |
242 |
| - [DomainException::class => 200], |
243 |
| - [DomainException::class => 300], |
| 240 | + [\DomainException::class => 100], |
| 241 | + [\DomainException::class => 200], |
| 242 | + [\DomainException::class => 300], |
244 | 243 | 300,
|
245 | 244 | ];
|
246 | 245 |
|
247 | 246 | yield 'on resource attributes' => [
|
248 | 247 | [],
|
249 |
| - [DomainException::class => 200], |
| 248 | + [\DomainException::class => 200], |
250 | 249 | null,
|
251 | 250 | 200,
|
252 | 251 | ];
|
253 | 252 |
|
254 | 253 | yield 'on resource attributes with empty operation attributes' => [
|
255 | 254 | [],
|
256 |
| - [DomainException::class => 200], |
| 255 | + [\DomainException::class => 200], |
257 | 256 | [],
|
258 | 257 | 200,
|
259 | 258 | ];
|
260 | 259 |
|
261 | 260 | yield 'on resource and operation attributes' => [
|
262 | 261 | [],
|
263 |
| - [DomainException::class => 200], |
264 |
| - [DomainException::class => 300], |
| 262 | + [\DomainException::class => 200], |
| 263 | + [\DomainException::class => 300], |
265 | 264 | 300,
|
266 | 265 | ];
|
267 | 266 |
|
268 | 267 | yield 'on operation attributes' => [
|
269 | 268 | [],
|
270 | 269 | null,
|
271 |
| - [DomainException::class => 300], |
| 270 | + [\DomainException::class => 300], |
272 | 271 | 300,
|
273 | 272 | ];
|
274 | 273 |
|
275 | 274 | yield 'on operation attributes with empty resource attributes' => [
|
276 | 275 | [],
|
277 | 276 | [],
|
278 |
| - [DomainException::class => 300], |
| 277 | + [\DomainException::class => 300], |
279 | 278 | 300,
|
280 | 279 | ];
|
281 | 280 | }
|
|
0 commit comments