Skip to content

Commit 57a8094

Browse files
committed
Removed support for webonyx/grpahql-php 0.11 and 0.12
1 parent 0aef7ef commit 57a8094

11 files changed

+49
-101
lines changed

tests/Config/Parser/GraphQLParserTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Overblog\GraphQLBundle\Config\Parser\GraphQL\ASTConverter\CustomScalarNode;
88
use Overblog\GraphQLBundle\Config\Parser\GraphQLParser;
9-
use Overblog\GraphQLBundle\Tests\VersionHelper;
109
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1110
use Symfony\Component\DependencyInjection\ContainerBuilder;
1211
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

tests/Error/ErrorHandlerTest.php

+22-23
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Overblog\GraphQLBundle\Error\UserError;
1212
use Overblog\GraphQLBundle\Error\UserErrors;
1313
use Overblog\GraphQLBundle\Error\UserWarning;
14-
use Overblog\GraphQLBundle\Tests\VersionHelper;
1514
use PHPUnit\Framework\TestCase;
1615
use Symfony\Component\EventDispatcher\EventDispatcher;
1716

@@ -50,44 +49,44 @@ public function testMaskErrorWithThrowExceptionSetToFalse(): void
5049
'errors' => [
5150
[
5251
'message' => 'Error without wrapped exception',
53-
'category' => 'graphql',
52+
'extensions' => ['category' => 'graphql'],
5453
],
5554
[
5655
'message' => ErrorHandler::DEFAULT_ERROR_MESSAGE,
57-
'category' => 'internal',
56+
'extensions' => ['category' => 'internal'],
5857
],
5958
[
6059
'message' => 'Error with wrapped user error',
61-
'category' => 'user',
60+
'extensions' => ['category' => 'user'],
6261
],
6362
[
6463
'message' => 'Error with wrapped base user error',
65-
'category' => 'user',
64+
'extensions' => ['category' => 'user'],
6665
],
6766
[
6867
'message' => 'My User Error 1',
69-
'category' => 'user',
68+
'extensions' => ['category' => 'user'],
7069
],
7170
[
7271
'message' => 'My User Error 2',
73-
'category' => 'user',
72+
'extensions' => ['category' => 'user'],
7473
],
7574
[
7675
'message' => 'My User Error 3',
77-
'category' => 'user',
76+
'extensions' => ['category' => 'user'],
7877
],
7978
],
8079
'extensions' => [
8180
'warnings' => [
8281
[
8382
'message' => 'Error with wrapped user warning',
84-
'category' => 'user',
83+
'extensions' => ['category' => 'user'],
8584
],
8685
],
8786
],
8887
];
8988

90-
$this->assertSame(VersionHelper::normalizedPayload($expected), $executionResult->toArray());
89+
$this->assertSame($expected, $executionResult->toArray());
9190
}
9291

9392
public function testMaskErrorWithWrappedExceptionAndThrowExceptionSetToTrue(): void
@@ -131,12 +130,12 @@ public function testMaskErrorWithWrappedUserErrorAndThrowExceptionSetToTrue(): v
131130
'errors' => [
132131
[
133132
'message' => 'Error with wrapped user error',
134-
'category' => 'user',
133+
'extensions' => ['category' => 'user'],
135134
],
136135
],
137136
];
138137

139-
$this->assertSame(VersionHelper::normalizedPayload($expected), $executionResult->toArray());
138+
$this->assertSame($expected, $executionResult->toArray());
140139
}
141140

142141
public function testDebugEnabled(): void
@@ -177,12 +176,12 @@ public function testMaskErrorWithoutWrappedExceptionAndThrowExceptionSetToTrue()
177176
'errors' => [
178177
[
179178
'message' => 'Error without wrapped exception',
180-
'category' => 'graphql',
179+
'extensions' => ['category' => 'graphql'],
181180
],
182181
],
183182
];
184183

185-
$this->assertSame(VersionHelper::normalizedPayload($expected), $executionResult->toArray());
184+
$this->assertSame($expected, $executionResult->toArray());
186185
}
187186

188187
public function testConvertExceptionToUserWarning(): void
@@ -203,13 +202,13 @@ public function testConvertExceptionToUserWarning(): void
203202
'warnings' => [
204203
[
205204
'message' => 'Error with invalid argument exception',
206-
'category' => 'user',
205+
'extensions' => ['category' => 'user'],
207206
],
208207
],
209208
],
210209
];
211210

212-
$this->assertSame(VersionHelper::normalizedPayload($expected), $executionResult->toArray());
211+
$this->assertSame($expected, $executionResult->toArray());
213212
}
214213

215214
/**
@@ -243,7 +242,7 @@ public function testConvertExceptionUsingParentExceptionMatchesAlwaysFirstExactE
243242
$errorHandler->handleErrors($executionResult, true);
244243

245244
if (\is_array($expectedUserError)) {
246-
$this->assertSame(VersionHelper::normalizedPayload($expectedUserError), $executionResult->toArray());
245+
$this->assertSame($expectedUserError, $executionResult->toArray());
247246
}
248247
}
249248

@@ -262,7 +261,7 @@ public function parentExceptionMappingDataProvider()
262261
'errors' => [
263262
[
264263
'message' => 'Error with invalid argument exception',
265-
'category' => 'user',
264+
'extensions' => ['category' => 'user'],
266265
],
267266
],
268267
],
@@ -288,7 +287,7 @@ public function parentExceptionMappingDataProvider()
288287
'errors' => [
289288
[
290289
'message' => 'Error with invalid argument exception',
291-
'category' => 'user',
290+
'extensions' => ['category' => 'user'],
292291
],
293292
],
294293
],
@@ -303,7 +302,7 @@ public function parentExceptionMappingDataProvider()
303302
'warnings' => [
304303
[
305304
'message' => 'Error with invalid argument exception',
306-
'category' => 'user',
305+
'extensions' => ['category' => 'user'],
307306
],
308307
],
309308
],
@@ -319,7 +318,7 @@ public function parentExceptionMappingDataProvider()
319318
'errors' => [
320319
[
321320
'message' => 'Error with invalid argument exception',
322-
'category' => 'user',
321+
'extensions' => ['category' => 'user'],
323322
],
324323
],
325324
],
@@ -335,7 +334,7 @@ public function parentExceptionMappingDataProvider()
335334
'warnings' => [
336335
[
337336
'message' => 'Error with invalid argument exception',
338-
'category' => 'user',
337+
'extensions' => ['category' => 'user'],
339338
],
340339
],
341340
],
@@ -351,7 +350,7 @@ public function parentExceptionMappingDataProvider()
351350
'errors' => [
352351
[
353352
'message' => 'Error with invalid argument exception',
354-
'category' => 'user',
353+
'extensions' => ['category' => 'user'],
355354
],
356355
],
357356
],

tests/Functional/Command/GraphDumpSchemaCommandTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Overblog\GraphQLBundle\Tests\Functional\Command;
66

77
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
8-
use Overblog\GraphQLBundle\Tests\VersionHelper;
98
use Symfony\Component\Console\Command\Command;
109
use Symfony\Component\Console\Tester\CommandTester;
1110

tests/Functional/Exception/ExceptionTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Overblog\GraphQLBundle\Tests\Functional\Exception;
66

77
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
8-
use Overblog\GraphQLBundle\Tests\VersionHelper;
98

109
class ExceptionTest extends TestCase
1110
{
@@ -31,7 +30,7 @@ public function testExceptionIsMappedToAWarning(): void
3130
$expectedErrors = [
3231
[
3332
'message' => 'Invalid argument exception',
34-
'category' => 'user',
33+
'extensions' => ['category' => 'user'],
3534
'locations' => [
3635
[
3736
'line' => 2,
@@ -42,6 +41,6 @@ public function testExceptionIsMappedToAWarning(): void
4241
],
4342
];
4443

45-
$this->assertGraphQL($query, $expectedData, VersionHelper::normalizedErrors($expectedErrors));
44+
$this->assertGraphQL($query, $expectedData, $expectedErrors);
4645
}
4746
}

tests/Functional/MultipleQueries/MultipleQueriesTest.php

+8-9
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
namespace Overblog\GraphQLBundle\Tests\Functional\MultipleQueries;
66

77
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
8-
use Overblog\GraphQLBundle\Tests\VersionHelper;
98

109
class MultipleQueriesTest extends TestCase
1110
{
12-
public const REQUIRED_FAILS_ERRORS = [
11+
private const REQUIRED_FAILS_ERRORS = [
1312
[
1413
'message' => 'Internal server Error',
15-
'category' => 'internal',
14+
'extensions' => ['category' => 'internal'],
1615
'locations' => [
1716
[
1817
'line' => 2,
@@ -25,11 +24,11 @@ class MultipleQueriesTest extends TestCase
2524
],
2625
];
2726

28-
public const OPTIONAL_FAILS = [
27+
private const OPTIONAL_FAILS = [
2928
'errors' => [
3029
[
3130
'message' => 'Internal server Error',
32-
'category' => 'internal',
31+
'extensions' => ['category' => 'internal'],
3332
'locations' => [
3433
[
3534
'line' => 2,
@@ -63,7 +62,7 @@ public function testRequiredFails(): void
6362
}
6463
EOF;
6564
$result = $this->executeGraphQLRequest($query);
66-
$this->assertSame(VersionHelper::normalizedErrors(self::REQUIRED_FAILS_ERRORS), $result['errors']);
65+
$this->assertSame(self::REQUIRED_FAILS_ERRORS, $result['errors']);
6766
$this->assertTrue(empty($result['data']));
6867
}
6968

@@ -76,7 +75,7 @@ public function testOptionalFails(): void
7675
}
7776
EOF;
7877
$result = $this->executeGraphQLRequest($query);
79-
$this->assertSame(VersionHelper::normalizedPayload(self::OPTIONAL_FAILS), $result);
78+
$this->assertSame(self::OPTIONAL_FAILS, $result);
8079
}
8180

8281
public function testMutationRequiredFails(): void
@@ -88,7 +87,7 @@ public function testMutationRequiredFails(): void
8887
}
8988
EOF;
9089
$result = $this->executeGraphQLRequest($query);
91-
$this->assertSame(VersionHelper::normalizedErrors(self::REQUIRED_FAILS_ERRORS), $result['errors']);
90+
$this->assertSame(self::REQUIRED_FAILS_ERRORS, $result['errors']);
9291
$this->assertTrue(empty($result['data']));
9392
}
9493

@@ -101,6 +100,6 @@ public function testMutationOptionalFails(): void
101100
}
102101
EOF;
103102
$result = $this->executeGraphQLRequest($query);
104-
$this->assertSame(VersionHelper::normalizedPayload(self::OPTIONAL_FAILS), $result);
103+
$this->assertSame(self::OPTIONAL_FAILS, $result);
105104
}
106105
}

tests/Functional/Security/AccessTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testNotAuthenticatedUserAccessAsPromisedFulfilledFalse(): void
9292
'warnings' => [
9393
[
9494
'message' => 'Access denied to this field.',
95-
'category' => 'user',
95+
'extensions' => ['category' => 'user'],
9696
'locations' => [['line' => 1, 'column' => 45]],
9797
'path' => ['user', 'isEnabled'],
9898
],
@@ -118,7 +118,7 @@ public function testNotAuthenticatedUserAccessToUserName(): void
118118
'warnings' => [
119119
[
120120
'message' => 'Access denied to this field.',
121-
'category' => 'user',
121+
'extensions' => ['category' => 'user'],
122122
'locations' => [['line' => 1, 'column' => 16]],
123123
'path' => ['user', 'name'],
124124
],
@@ -139,7 +139,7 @@ public function testNonAuthenticatedUserAccessSecuredFieldWhichInitiallyResolves
139139
'warnings' => [
140140
[
141141
'message' => 'Access denied to this field.',
142-
'category' => 'user',
142+
'extensions' => ['category' => 'user'],
143143
'locations' => [
144144
[
145145
'line' => 2,
@@ -210,7 +210,7 @@ public function testUserForbiddenField(): void
210210
'warnings' => [
211211
[
212212
'message' => 'Access denied to this field.',
213-
'category' => 'user',
213+
'extensions' => ['category' => 'user'],
214214
'locations' => [
215215
[
216216
'line' => 3,
@@ -295,7 +295,7 @@ public function testMutationAllowedButNoRightsToDisplayPayload(): void
295295
'warnings' => [
296296
[
297297
'message' => 'Access denied to this field.',
298-
'category' => 'user',
298+
'extensions' => ['category' => 'user'],
299299
'locations' => [
300300
[
301301
'line' => 3,
@@ -318,7 +318,7 @@ public function testMutationNotAllowedUser(): void
318318
'errors' => [
319319
[
320320
'message' => 'Access denied to this field.',
321-
'category' => 'user',
321+
'extensions' => ['category' => 'user'],
322322
'locations' => [
323323
[
324324
'line' => 2,
@@ -349,7 +349,7 @@ private function expectedFailedUserRoles()
349349
'warnings' => [
350350
[
351351
'message' => 'Access denied to this field.',
352-
'category' => 'user',
352+
'extensions' => ['category' => 'user'],
353353
'locations' => [
354354
[
355355
'line' => 1,

tests/Functional/Security/DisableIntrospectionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testIntrospectionDisabled(): void
2525
'errors' => [
2626
[
2727
'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type',
28-
'category' => 'graphql',
28+
'extensions' => ['category' => 'graphql'],
2929
'locations' => [
3030
[
3131
'line' => 2,

tests/Functional/Security/QueryComplexityTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testComplexityReachLimitation(): void
4242
'errors' => [
4343
[
4444
'message' => 'Max query complexity should be 10 but got 54.',
45-
'category' => 'graphql',
45+
'extensions' => ['category' => 'graphql'],
4646
],
4747
],
4848
];
@@ -56,7 +56,7 @@ public function testComplexityReachLimitationEnv(): void
5656
'errors' => [
5757
[
5858
'message' => 'Max query complexity should be 10 but got 54.',
59-
'category' => 'graphql',
59+
'extensions' => ['category' => 'graphql'],
6060
],
6161
],
6262
];

tests/Functional/Security/QueryMaxDepthTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testMaxDepthReachLimitation(): void
4949
'errors' => [
5050
[
5151
'message' => 'Max query depth should be 3 but got 6.',
52-
'category' => 'graphql',
52+
'extensions' => ['category' => 'graphql'],
5353
],
5454
],
5555
];
@@ -63,7 +63,7 @@ public function testMaxDepthReachLimitationEnv(): void
6363
'errors' => [
6464
[
6565
'message' => 'Max query depth should be 3 but got 6.',
66-
'category' => 'graphql',
66+
'extensions' => ['category' => 'graphql'],
6767
],
6868
],
6969
];

0 commit comments

Comments
 (0)