11
11
use Overblog \GraphQLBundle \Error \UserError ;
12
12
use Overblog \GraphQLBundle \Error \UserErrors ;
13
13
use Overblog \GraphQLBundle \Error \UserWarning ;
14
- use Overblog \GraphQLBundle \Tests \VersionHelper ;
15
14
use PHPUnit \Framework \TestCase ;
16
15
use Symfony \Component \EventDispatcher \EventDispatcher ;
17
16
@@ -50,44 +49,44 @@ public function testMaskErrorWithThrowExceptionSetToFalse(): void
50
49
'errors ' => [
51
50
[
52
51
'message ' => 'Error without wrapped exception ' ,
53
- 'category ' => 'graphql ' ,
52
+ 'extensions ' => [ ' category ' => 'graphql ' ] ,
54
53
],
55
54
[
56
55
'message ' => ErrorHandler::DEFAULT_ERROR_MESSAGE ,
57
- 'category ' => 'internal ' ,
56
+ 'extensions ' => [ ' category ' => 'internal ' ] ,
58
57
],
59
58
[
60
59
'message ' => 'Error with wrapped user error ' ,
61
- 'category ' => 'user ' ,
60
+ 'extensions ' => [ ' category ' => 'user ' ] ,
62
61
],
63
62
[
64
63
'message ' => 'Error with wrapped base user error ' ,
65
- 'category ' => 'user ' ,
64
+ 'extensions ' => [ ' category ' => 'user ' ] ,
66
65
],
67
66
[
68
67
'message ' => 'My User Error 1 ' ,
69
- 'category ' => 'user ' ,
68
+ 'extensions ' => [ ' category ' => 'user ' ] ,
70
69
],
71
70
[
72
71
'message ' => 'My User Error 2 ' ,
73
- 'category ' => 'user ' ,
72
+ 'extensions ' => [ ' category ' => 'user ' ] ,
74
73
],
75
74
[
76
75
'message ' => 'My User Error 3 ' ,
77
- 'category ' => 'user ' ,
76
+ 'extensions ' => [ ' category ' => 'user ' ] ,
78
77
],
79
78
],
80
79
'extensions ' => [
81
80
'warnings ' => [
82
81
[
83
82
'message ' => 'Error with wrapped user warning ' ,
84
- 'category ' => 'user ' ,
83
+ 'extensions ' => [ ' category ' => 'user ' ] ,
85
84
],
86
85
],
87
86
],
88
87
];
89
88
90
- $ this ->assertSame (VersionHelper:: normalizedPayload ( $ expected) , $ executionResult ->toArray ());
89
+ $ this ->assertSame ($ expected , $ executionResult ->toArray ());
91
90
}
92
91
93
92
public function testMaskErrorWithWrappedExceptionAndThrowExceptionSetToTrue (): void
@@ -131,12 +130,12 @@ public function testMaskErrorWithWrappedUserErrorAndThrowExceptionSetToTrue(): v
131
130
'errors ' => [
132
131
[
133
132
'message ' => 'Error with wrapped user error ' ,
134
- 'category ' => 'user ' ,
133
+ 'extensions ' => [ ' category ' => 'user ' ] ,
135
134
],
136
135
],
137
136
];
138
137
139
- $ this ->assertSame (VersionHelper:: normalizedPayload ( $ expected) , $ executionResult ->toArray ());
138
+ $ this ->assertSame ($ expected , $ executionResult ->toArray ());
140
139
}
141
140
142
141
public function testDebugEnabled (): void
@@ -177,12 +176,12 @@ public function testMaskErrorWithoutWrappedExceptionAndThrowExceptionSetToTrue()
177
176
'errors ' => [
178
177
[
179
178
'message ' => 'Error without wrapped exception ' ,
180
- 'category ' => 'graphql ' ,
179
+ 'extensions ' => [ ' category ' => 'graphql ' ] ,
181
180
],
182
181
],
183
182
];
184
183
185
- $ this ->assertSame (VersionHelper:: normalizedPayload ( $ expected) , $ executionResult ->toArray ());
184
+ $ this ->assertSame ($ expected , $ executionResult ->toArray ());
186
185
}
187
186
188
187
public function testConvertExceptionToUserWarning (): void
@@ -203,13 +202,13 @@ public function testConvertExceptionToUserWarning(): void
203
202
'warnings ' => [
204
203
[
205
204
'message ' => 'Error with invalid argument exception ' ,
206
- 'category ' => 'user ' ,
205
+ 'extensions ' => [ ' category ' => 'user ' ] ,
207
206
],
208
207
],
209
208
],
210
209
];
211
210
212
- $ this ->assertSame (VersionHelper:: normalizedPayload ( $ expected) , $ executionResult ->toArray ());
211
+ $ this ->assertSame ($ expected , $ executionResult ->toArray ());
213
212
}
214
213
215
214
/**
@@ -243,7 +242,7 @@ public function testConvertExceptionUsingParentExceptionMatchesAlwaysFirstExactE
243
242
$ errorHandler ->handleErrors ($ executionResult , true );
244
243
245
244
if (\is_array ($ expectedUserError )) {
246
- $ this ->assertSame (VersionHelper:: normalizedPayload ( $ expectedUserError) , $ executionResult ->toArray ());
245
+ $ this ->assertSame ($ expectedUserError , $ executionResult ->toArray ());
247
246
}
248
247
}
249
248
@@ -262,7 +261,7 @@ public function parentExceptionMappingDataProvider()
262
261
'errors ' => [
263
262
[
264
263
'message ' => 'Error with invalid argument exception ' ,
265
- 'category ' => 'user ' ,
264
+ 'extensions ' => [ ' category ' => 'user ' ] ,
266
265
],
267
266
],
268
267
],
@@ -288,7 +287,7 @@ public function parentExceptionMappingDataProvider()
288
287
'errors ' => [
289
288
[
290
289
'message ' => 'Error with invalid argument exception ' ,
291
- 'category ' => 'user ' ,
290
+ 'extensions ' => [ ' category ' => 'user ' ] ,
292
291
],
293
292
],
294
293
],
@@ -303,7 +302,7 @@ public function parentExceptionMappingDataProvider()
303
302
'warnings ' => [
304
303
[
305
304
'message ' => 'Error with invalid argument exception ' ,
306
- 'category ' => 'user ' ,
305
+ 'extensions ' => [ ' category ' => 'user ' ] ,
307
306
],
308
307
],
309
308
],
@@ -319,7 +318,7 @@ public function parentExceptionMappingDataProvider()
319
318
'errors ' => [
320
319
[
321
320
'message ' => 'Error with invalid argument exception ' ,
322
- 'category ' => 'user ' ,
321
+ 'extensions ' => [ ' category ' => 'user ' ] ,
323
322
],
324
323
],
325
324
],
@@ -335,7 +334,7 @@ public function parentExceptionMappingDataProvider()
335
334
'warnings ' => [
336
335
[
337
336
'message ' => 'Error with invalid argument exception ' ,
338
- 'category ' => 'user ' ,
337
+ 'extensions ' => [ ' category ' => 'user ' ] ,
339
338
],
340
339
],
341
340
],
@@ -351,7 +350,7 @@ public function parentExceptionMappingDataProvider()
351
350
'errors ' => [
352
351
[
353
352
'message ' => 'Error with invalid argument exception ' ,
354
- 'category ' => 'user ' ,
353
+ 'extensions ' => [ ' category ' => 'user ' ] ,
355
354
],
356
355
],
357
356
],
0 commit comments