We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -9,32 +9,3 @@ |
||
9 | 9 | final class DisableIntrospectionTest extends TestCase |
10 | 10 | { |
11 | 11 | private string $introspectionQuery = <<<'EOF' |
12 | - query { |
|
13 | - __schema { |
|
14 | - types { |
|
15 | - name |
|
16 | - description |
|
17 | - } |
|
18 | - } |
|
19 | - } |
|
20 | - EOF; |
|
21 | - |
|
22 | - public function testIntrospectionDisabled(): void |
|
23 | - { |
|
24 | - $expected = [ |
|
25 | - 'errors' => [ |
|
26 | - [ |
|
27 | - 'message' => 'GraphQL introspection is not allowed, but the query contained __schema or __type', |
|
28 | - 'locations' => [ |
|
29 | - [ |
|
30 | - 'line' => 2, |
|
31 | - 'column' => 3, |
|
32 | - ], |
|
33 | - ], |
|
34 | - ], |
|
35 | - ], |
|
36 | - ]; |
|
37 | - |
|
38 | - $this->assertResponse($this->introspectionQuery, $expected, self::ANONYMOUS_USER, 'disableIntrospection'); |
|
39 | - } |
|
40 | -} |
@@ -46,7 +46,7 @@ |
||
46 | 46 | private ?ResolverArgs $__resolverArgs; |
47 | 47 | |
48 | 48 | public function __construct( |
49 | - ObjectType|InputObjectType $type, |
|
49 | + ObjectType | InputObjectType $type, |
|
50 | 50 | string $field = null, |
51 | 51 | ?ValidationNode $parent = null, |
52 | 52 | ?ResolverArgs $resolverArgs = null |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @throws ArgumentsValidationException |
64 | 64 | */ |
65 | - public function validate(string|array|null $groups = null, bool $throw = true): ?ConstraintViolationListInterface |
|
65 | + public function validate(string | array | null $groups = null, bool $throw = true): ?ConstraintViolationListInterface |
|
66 | 66 | { |
67 | 67 | $rootNode = new ValidationNode( |
68 | 68 | $this->info->parentType, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | return $rootObject; |
207 | 207 | } |
208 | 208 | |
209 | - private static function isListOfType(GeneratedTypeInterface|ListOfType|NonNull $type): bool |
|
209 | + private static function isListOfType(GeneratedTypeInterface | ListOfType | NonNull $type): bool |
|
210 | 210 | { |
211 | 211 | if ($type instanceof ListOfType || ($type instanceof NonNull && $type->getWrappedType() instanceof ListOfType)) { |
212 | 212 | return true; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - private function createCollectionNode(array $values, ObjectType|InputObjectType $type, ValidationNode $parent): array |
|
218 | + private function createCollectionNode(array $values, ObjectType | InputObjectType $type, ValidationNode $parent): array |
|
219 | 219 | { |
220 | 220 | $collection = []; |
221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return $collection; |
227 | 227 | } |
228 | 228 | |
229 | - private function createObjectNode(array $value, ObjectType|InputObjectType $type, ValidationNode $parent): ValidationNode |
|
229 | + private function createObjectNode(array $value, ObjectType | InputObjectType $type, ValidationNode $parent): ValidationNode |
|
230 | 230 | { |
231 | 231 | /** @phpstan-ignore-next-line */ |
232 | 232 | $classValidation = static::normalizeConfig($type->config['validation'] ?? []); |
@@ -18,8 +18,8 @@ |
||
18 | 18 | protected function getResolverSolutionsMapping(): array |
19 | 19 | { |
20 | 20 | return [ |
21 | - 'Toto' => ['factory' => fn () => new ObjectType(['name' => 'Toto', 'fields' => []]), 'aliases' => ['foo']], |
|
22 | - 'Tata' => ['factory' => fn () => new ObjectType(['name' => 'Tata', 'fields' => []]), 'aliases' => ['bar']], |
|
21 | + 'Toto' => ['factory' => fn() => new ObjectType(['name' => 'Toto', 'fields' => []]), 'aliases' => ['foo']], |
|
22 | + 'Tata' => ['factory' => fn() => new ObjectType(['name' => 'Tata', 'fields' => []]), 'aliases' => ['bar']], |
|
23 | 23 | ]; |
24 | 24 | } |
25 | 25 |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | public function testScalarTypeConfig(): void |
23 | 23 | { |
24 | 24 | $this->assertScalarTypeConfig(new YearScalarType()); |
25 | - $this->assertScalarTypeConfig(fn () => new YearScalarType()); |
|
25 | + $this->assertScalarTypeConfig(fn() => new YearScalarType()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function testWithoutScalarTypeConfig(): void |
29 | 29 | { |
30 | - $genericFunc = fn ($value) => $value; |
|
30 | + $genericFunc = fn($value) => $value; |
|
31 | 31 | /** @phpstan-ignore-next-line */ |
32 | 32 | $type = new CustomScalarType([ |
33 | 33 | 'serialize' => $genericFunc, |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | ScalarType::class, |
58 | 58 | $got |
59 | 59 | )); |
60 | - $type = new CustomScalarType(['name' => $name, 'scalarType' => $scalarType, 'serialize' => fn (mixed $input): mixed => '']); |
|
60 | + $type = new CustomScalarType(['name' => $name, 'scalarType' => $scalarType, 'serialize' => fn(mixed $input): mixed => '']); |
|
61 | 61 | $type->assertValid(); |
62 | 62 | } |
63 | 63 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | yield [false, 'false']; |
67 | 67 | yield [new stdClass(), 'instance of stdClass']; |
68 | 68 | yield [ |
69 | - fn () => false, |
|
69 | + fn() => false, |
|
70 | 70 | 'false', |
71 | 71 | ]; |
72 | 72 | yield [ |
73 | - fn () => new stdClass(), |
|
73 | + fn() => new stdClass(), |
|
74 | 74 | 'instance of stdClass', |
75 | 75 | ]; |
76 | 76 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | { |
85 | 85 | $type = new CustomScalarType([ |
86 | 86 | 'scalarType' => $scalarType, |
87 | - 'serialize' => fn () => 'serialize', |
|
88 | - 'parseValue' => fn () => 'parseValue', |
|
89 | - 'parseLiteral' => fn () => 'parseLiteral', |
|
87 | + 'serialize' => fn() => 'serialize', |
|
88 | + 'parseValue' => fn() => 'parseValue', |
|
89 | + 'parseLiteral' => fn() => 'parseLiteral', |
|
90 | 90 | ]); |
91 | 91 | |
92 | 92 | $this->assertSame('50 AC', $type->serialize(50)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return parent::$type($value); |
78 | 78 | } |
79 | 79 | |
80 | - $scalarType = match (true) { |
|
80 | + $scalarType = match(true) { |
|
81 | 81 | $this->config['scalarType'] instanceof ScalarType => $this->config['scalarType'], |
82 | 82 | is_callable($this->config['scalarType']) => $this->config['scalarType'](), |
83 | 83 | default => $this->config['scalarType'], |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | - $scalarType = match (true) { |
|
97 | + $scalarType = match(true) { |
|
98 | 98 | $this->config['scalarType'] instanceof ScalarType => $this->config['scalarType'], |
99 | 99 | is_callable($this->config['scalarType']) => $this->config['scalarType'](), |
100 | 100 | default => $this->config['scalarType'], |
@@ -111,38 +111,3 @@ |
||
111 | 111 | |
112 | 112 | // this is the part is why we must make this test run in separate process |
113 | 113 | $query = <<<'EOF' |
114 | - mutation { |
|
115 | - conflictingValidatorNamespaces(test: "123", test2: "1", test3: "4") |
|
116 | - } |
|
117 | - EOF; |
|
118 | - |
|
119 | - $response = static::query( |
|
120 | - $query, |
|
121 | - self::USER_RYAN, |
|
122 | - 'conflictingValidatorNamespaces' |
|
123 | - )->getResponse()->getContent(); |
|
124 | - |
|
125 | - $this->assertEquals('{"data":{"conflictingValidatorNamespaces":true}}', $response); |
|
126 | - // end part |
|
127 | - |
|
128 | - // Validate definition file |
|
129 | - /** @var string $definitionFile */ |
|
130 | - $definitionFile = file_get_contents($kernel->getCacheDir().'/overblog/graphql-bundle/__definitions__/MutationType.php'); |
|
131 | - |
|
132 | - $this->assertStringContainsString( |
|
133 | - 'use Symfony\Component\Validator\Constraints as SymfonyConstraints;', |
|
134 | - $definitionFile, |
|
135 | - 'Generated definition file should contain import of Symfony\Component\Validator\Constraints aliased as SymfonyConstraints' |
|
136 | - ); |
|
137 | - $this->assertStringNotContainsString( |
|
138 | - 'use '.Validator\CustomValidator1\Constraint::class, |
|
139 | - $definitionFile, |
|
140 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
141 | - ); |
|
142 | - $this->assertStringNotContainsString( |
|
143 | - 'use '.Validator\CustomValidator2\Constraint::class, |
|
144 | - $definitionFile, |
|
145 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
146 | - ); |
|
147 | - } |
|
148 | -} |
@@ -111,38 +111,3 @@ |
||
111 | 111 | |
112 | 112 | // this is the part is why we must make this test run in separate process |
113 | 113 | $query = <<<'EOF' |
114 | - mutation { |
|
115 | - conflictingValidatorNamespaces(test: "123", test2: "1", test3: "4") |
|
116 | - } |
|
117 | - EOF; |
|
118 | - |
|
119 | - $response = static::query( |
|
120 | - $query, |
|
121 | - self::USER_RYAN, |
|
122 | - 'conflictingValidatorNamespaces' |
|
123 | - )->getResponse()->getContent(); |
|
124 | - |
|
125 | - $this->assertEquals('{"data":{"conflictingValidatorNamespaces":true}}', $response); |
|
126 | - // end part |
|
127 | - |
|
128 | - // Validate definition file |
|
129 | - /** @var string $definitionFile */ |
|
130 | - $definitionFile = file_get_contents($kernel->getCacheDir().'/overblog/graphql-bundle/__definitions__/MutationType.php'); |
|
131 | - |
|
132 | - $this->assertStringContainsString( |
|
133 | - 'use Symfony\Component\Validator\Constraints as SymfonyConstraints;', |
|
134 | - $definitionFile, |
|
135 | - 'Generated definition file should contain import of Symfony\Component\Validator\Constraints aliased as SymfonyConstraints' |
|
136 | - ); |
|
137 | - $this->assertStringNotContainsString( |
|
138 | - 'use '.Validator\CustomValidator1\Constraint::class, |
|
139 | - $definitionFile, |
|
140 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
141 | - ); |
|
142 | - $this->assertStringNotContainsString( |
|
143 | - 'use '.Validator\CustomValidator2\Constraint::class, |
|
144 | - $definitionFile, |
|
145 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
146 | - ); |
|
147 | - } |
|
148 | -} |
@@ -111,38 +111,3 @@ |
||
111 | 111 | |
112 | 112 | // this is the part is why we must make this test run in separate process |
113 | 113 | $query = <<<'EOF' |
114 | - mutation { |
|
115 | - conflictingValidatorNamespaces(test: "123", test2: "1", test3: "4") |
|
116 | - } |
|
117 | - EOF; |
|
118 | - |
|
119 | - $response = static::query( |
|
120 | - $query, |
|
121 | - self::USER_RYAN, |
|
122 | - 'conflictingValidatorNamespaces' |
|
123 | - )->getResponse()->getContent(); |
|
124 | - |
|
125 | - $this->assertEquals('{"data":{"conflictingValidatorNamespaces":true}}', $response); |
|
126 | - // end part |
|
127 | - |
|
128 | - // Validate definition file |
|
129 | - /** @var string $definitionFile */ |
|
130 | - $definitionFile = file_get_contents($kernel->getCacheDir().'/overblog/graphql-bundle/__definitions__/MutationType.php'); |
|
131 | - |
|
132 | - $this->assertStringContainsString( |
|
133 | - 'use Symfony\Component\Validator\Constraints as SymfonyConstraints;', |
|
134 | - $definitionFile, |
|
135 | - 'Generated definition file should contain import of Symfony\Component\Validator\Constraints aliased as SymfonyConstraints' |
|
136 | - ); |
|
137 | - $this->assertStringNotContainsString( |
|
138 | - 'use '.Validator\CustomValidator1\Constraint::class, |
|
139 | - $definitionFile, |
|
140 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
141 | - ); |
|
142 | - $this->assertStringNotContainsString( |
|
143 | - 'use '.Validator\CustomValidator2\Constraint::class, |
|
144 | - $definitionFile, |
|
145 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
146 | - ); |
|
147 | - } |
|
148 | -} |
@@ -111,38 +111,3 @@ |
||
111 | 111 | |
112 | 112 | // this is the part is why we must make this test run in separate process |
113 | 113 | $query = <<<'EOF' |
114 | - mutation { |
|
115 | - conflictingValidatorNamespaces(test: "123", test2: "1", test3: "4") |
|
116 | - } |
|
117 | - EOF; |
|
118 | - |
|
119 | - $response = static::query( |
|
120 | - $query, |
|
121 | - self::USER_RYAN, |
|
122 | - 'conflictingValidatorNamespaces' |
|
123 | - )->getResponse()->getContent(); |
|
124 | - |
|
125 | - $this->assertEquals('{"data":{"conflictingValidatorNamespaces":true}}', $response); |
|
126 | - // end part |
|
127 | - |
|
128 | - // Validate definition file |
|
129 | - /** @var string $definitionFile */ |
|
130 | - $definitionFile = file_get_contents($kernel->getCacheDir().'/overblog/graphql-bundle/__definitions__/MutationType.php'); |
|
131 | - |
|
132 | - $this->assertStringContainsString( |
|
133 | - 'use Symfony\Component\Validator\Constraints as SymfonyConstraints;', |
|
134 | - $definitionFile, |
|
135 | - 'Generated definition file should contain import of Symfony\Component\Validator\Constraints aliased as SymfonyConstraints' |
|
136 | - ); |
|
137 | - $this->assertStringNotContainsString( |
|
138 | - 'use '.Validator\CustomValidator1\Constraint::class, |
|
139 | - $definitionFile, |
|
140 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
141 | - ); |
|
142 | - $this->assertStringNotContainsString( |
|
143 | - 'use '.Validator\CustomValidator2\Constraint::class, |
|
144 | - $definitionFile, |
|
145 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
146 | - ); |
|
147 | - } |
|
148 | -} |
@@ -111,38 +111,3 @@ |
||
111 | 111 | |
112 | 112 | // this is the part is why we must make this test run in separate process |
113 | 113 | $query = <<<'EOF' |
114 | - mutation { |
|
115 | - conflictingValidatorNamespaces(test: "123", test2: "1", test3: "4") |
|
116 | - } |
|
117 | - EOF; |
|
118 | - |
|
119 | - $response = static::query( |
|
120 | - $query, |
|
121 | - self::USER_RYAN, |
|
122 | - 'conflictingValidatorNamespaces' |
|
123 | - )->getResponse()->getContent(); |
|
124 | - |
|
125 | - $this->assertEquals('{"data":{"conflictingValidatorNamespaces":true}}', $response); |
|
126 | - // end part |
|
127 | - |
|
128 | - // Validate definition file |
|
129 | - /** @var string $definitionFile */ |
|
130 | - $definitionFile = file_get_contents($kernel->getCacheDir().'/overblog/graphql-bundle/__definitions__/MutationType.php'); |
|
131 | - |
|
132 | - $this->assertStringContainsString( |
|
133 | - 'use Symfony\Component\Validator\Constraints as SymfonyConstraints;', |
|
134 | - $definitionFile, |
|
135 | - 'Generated definition file should contain import of Symfony\Component\Validator\Constraints aliased as SymfonyConstraints' |
|
136 | - ); |
|
137 | - $this->assertStringNotContainsString( |
|
138 | - 'use '.Validator\CustomValidator1\Constraint::class, |
|
139 | - $definitionFile, |
|
140 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
141 | - ); |
|
142 | - $this->assertStringNotContainsString( |
|
143 | - 'use '.Validator\CustomValidator2\Constraint::class, |
|
144 | - $definitionFile, |
|
145 | - 'Generated definition file should not contain imports of custom constraints, FQCN should be used instead' |
|
146 | - ); |
|
147 | - } |
|
148 | -} |
@@ -26,67 +26,3 @@ |
||
26 | 26 | $this->assertSame([['node' => ['username' => 'user1']]], $result['data']['users']['edges']); |
27 | 27 | |
28 | 28 | $query = <<<'EOF' |
29 | - mutation M { |
|
30 | - addUser(input: {username: "user1"}) { |
|
31 | - user { |
|
32 | - username |
|
33 | - } |
|
34 | - } |
|
35 | - } |
|
36 | - EOF; |
|
37 | - |
|
38 | - $expectedData = [ |
|
39 | - 'addUser' => [ |
|
40 | - 'user' => ['username' => 'user1'], |
|
41 | - ], |
|
42 | - ]; |
|
43 | - |
|
44 | - $this->assertGraphQL($query, $expectedData, null, [], 'public'); |
|
45 | - } |
|
46 | - |
|
47 | - public function testInternalSchema(): void |
|
48 | - { |
|
49 | - $result = $this->executeGraphQLRequest('{bar foo}', [], 'internal'); |
|
50 | - $this->assertSame('bar', $result['data']['bar']); |
|
51 | - $this->assertSame('foo', $result['data']['foo']); |
|
52 | - $this->assertSchemaQueryTypeName('InternalQuery'); |
|
53 | - |
|
54 | - $result = $this->executeGraphQLRequest('{users{edges{node{username email}}}}', [], 'internal'); |
|
55 | - $this->assertSame([['node' => ['username' => 'user1', 'email' => 'topsecret']]], $result['data']['users']['edges']); |
|
56 | - |
|
57 | - $query = <<<'EOF' |
|
58 | - mutation M { |
|
59 | - addUser(input: {username: "user1"}) { |
|
60 | - user { |
|
61 | - username |
|
62 | ||
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - EOF; |
|
67 | - |
|
68 | - $expectedData = [ |
|
69 | - 'addUser' => [ |
|
70 | - 'user' => ['username' => 'user1', 'email' => 'email1'], |
|
71 | - ], |
|
72 | - ]; |
|
73 | - |
|
74 | - $this->assertGraphQL($query, $expectedData, null, [], 'internal'); |
|
75 | - } |
|
76 | - |
|
77 | - public function testUnknownTypeShouldThrowAnUnresolvableException(): void |
|
78 | - { |
|
79 | - // @phpstan-ignore-next-line |
|
80 | - $schema = $this->getContainer()->get('overblog_graphql.request_executor')->getSchema('public'); |
|
81 | - $this->expectException(UnresolvableException::class); |
|
82 | - $this->expectExceptionMessage('Could not find type with alias "unknown". Did you forget to define it?'); |
|
83 | - $schema->getType('unknown'); |
|
84 | - } |
|
85 | - |
|
86 | - private function assertSchemaQueryTypeName(string $typeName): void |
|
87 | - { |
|
88 | - // @phpstan-ignore-next-line |
|
89 | - $query = $this->getContainer()->get('overblog_graphql.type_resolver')->resolve($typeName); |
|
90 | - $this->assertSame('Query', $query->name); |
|
91 | - } |
|
92 | -} |
@@ -26,67 +26,3 @@ |
||
26 | 26 | $this->assertSame([['node' => ['username' => 'user1']]], $result['data']['users']['edges']); |
27 | 27 | |
28 | 28 | $query = <<<'EOF' |
29 | - mutation M { |
|
30 | - addUser(input: {username: "user1"}) { |
|
31 | - user { |
|
32 | - username |
|
33 | - } |
|
34 | - } |
|
35 | - } |
|
36 | - EOF; |
|
37 | - |
|
38 | - $expectedData = [ |
|
39 | - 'addUser' => [ |
|
40 | - 'user' => ['username' => 'user1'], |
|
41 | - ], |
|
42 | - ]; |
|
43 | - |
|
44 | - $this->assertGraphQL($query, $expectedData, null, [], 'public'); |
|
45 | - } |
|
46 | - |
|
47 | - public function testInternalSchema(): void |
|
48 | - { |
|
49 | - $result = $this->executeGraphQLRequest('{bar foo}', [], 'internal'); |
|
50 | - $this->assertSame('bar', $result['data']['bar']); |
|
51 | - $this->assertSame('foo', $result['data']['foo']); |
|
52 | - $this->assertSchemaQueryTypeName('InternalQuery'); |
|
53 | - |
|
54 | - $result = $this->executeGraphQLRequest('{users{edges{node{username email}}}}', [], 'internal'); |
|
55 | - $this->assertSame([['node' => ['username' => 'user1', 'email' => 'topsecret']]], $result['data']['users']['edges']); |
|
56 | - |
|
57 | - $query = <<<'EOF' |
|
58 | - mutation M { |
|
59 | - addUser(input: {username: "user1"}) { |
|
60 | - user { |
|
61 | - username |
|
62 | ||
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - EOF; |
|
67 | - |
|
68 | - $expectedData = [ |
|
69 | - 'addUser' => [ |
|
70 | - 'user' => ['username' => 'user1', 'email' => 'email1'], |
|
71 | - ], |
|
72 | - ]; |
|
73 | - |
|
74 | - $this->assertGraphQL($query, $expectedData, null, [], 'internal'); |
|
75 | - } |
|
76 | - |
|
77 | - public function testUnknownTypeShouldThrowAnUnresolvableException(): void |
|
78 | - { |
|
79 | - // @phpstan-ignore-next-line |
|
80 | - $schema = $this->getContainer()->get('overblog_graphql.request_executor')->getSchema('public'); |
|
81 | - $this->expectException(UnresolvableException::class); |
|
82 | - $this->expectExceptionMessage('Could not find type with alias "unknown". Did you forget to define it?'); |
|
83 | - $schema->getType('unknown'); |
|
84 | - } |
|
85 | - |
|
86 | - private function assertSchemaQueryTypeName(string $typeName): void |
|
87 | - { |
|
88 | - // @phpstan-ignore-next-line |
|
89 | - $query = $this->getContainer()->get('overblog_graphql.type_resolver')->resolve($typeName); |
|
90 | - $this->assertSame('Query', $query->name); |
|
91 | - } |
|
92 | -} |
@@ -26,67 +26,3 @@ |
||
26 | 26 | $this->assertSame([['node' => ['username' => 'user1']]], $result['data']['users']['edges']); |
27 | 27 | |
28 | 28 | $query = <<<'EOF' |
29 | - mutation M { |
|
30 | - addUser(input: {username: "user1"}) { |
|
31 | - user { |
|
32 | - username |
|
33 | - } |
|
34 | - } |
|
35 | - } |
|
36 | - EOF; |
|
37 | - |
|
38 | - $expectedData = [ |
|
39 | - 'addUser' => [ |
|
40 | - 'user' => ['username' => 'user1'], |
|
41 | - ], |
|
42 | - ]; |
|
43 | - |
|
44 | - $this->assertGraphQL($query, $expectedData, null, [], 'public'); |
|
45 | - } |
|
46 | - |
|
47 | - public function testInternalSchema(): void |
|
48 | - { |
|
49 | - $result = $this->executeGraphQLRequest('{bar foo}', [], 'internal'); |
|
50 | - $this->assertSame('bar', $result['data']['bar']); |
|
51 | - $this->assertSame('foo', $result['data']['foo']); |
|
52 | - $this->assertSchemaQueryTypeName('InternalQuery'); |
|
53 | - |
|
54 | - $result = $this->executeGraphQLRequest('{users{edges{node{username email}}}}', [], 'internal'); |
|
55 | - $this->assertSame([['node' => ['username' => 'user1', 'email' => 'topsecret']]], $result['data']['users']['edges']); |
|
56 | - |
|
57 | - $query = <<<'EOF' |
|
58 | - mutation M { |
|
59 | - addUser(input: {username: "user1"}) { |
|
60 | - user { |
|
61 | - username |
|
62 | ||
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - EOF; |
|
67 | - |
|
68 | - $expectedData = [ |
|
69 | - 'addUser' => [ |
|
70 | - 'user' => ['username' => 'user1', 'email' => 'email1'], |
|
71 | - ], |
|
72 | - ]; |
|
73 | - |
|
74 | - $this->assertGraphQL($query, $expectedData, null, [], 'internal'); |
|
75 | - } |
|
76 | - |
|
77 | - public function testUnknownTypeShouldThrowAnUnresolvableException(): void |
|
78 | - { |
|
79 | - // @phpstan-ignore-next-line |
|
80 | - $schema = $this->getContainer()->get('overblog_graphql.request_executor')->getSchema('public'); |
|
81 | - $this->expectException(UnresolvableException::class); |
|
82 | - $this->expectExceptionMessage('Could not find type with alias "unknown". Did you forget to define it?'); |
|
83 | - $schema->getType('unknown'); |
|
84 | - } |
|
85 | - |
|
86 | - private function assertSchemaQueryTypeName(string $typeName): void |
|
87 | - { |
|
88 | - // @phpstan-ignore-next-line |
|
89 | - $query = $this->getContainer()->get('overblog_graphql.type_resolver')->resolve($typeName); |
|
90 | - $this->assertSame('Query', $query->name); |
|
91 | - } |
|
92 | -} |
@@ -26,67 +26,3 @@ |
||
26 | 26 | $this->assertSame([['node' => ['username' => 'user1']]], $result['data']['users']['edges']); |
27 | 27 | |
28 | 28 | $query = <<<'EOF' |
29 | - mutation M { |
|
30 | - addUser(input: {username: "user1"}) { |
|
31 | - user { |
|
32 | - username |
|
33 | - } |
|
34 | - } |
|
35 | - } |
|
36 | - EOF; |
|
37 | - |
|
38 | - $expectedData = [ |
|
39 | - 'addUser' => [ |
|
40 | - 'user' => ['username' => 'user1'], |
|
41 | - ], |
|
42 | - ]; |
|
43 | - |
|
44 | - $this->assertGraphQL($query, $expectedData, null, [], 'public'); |
|
45 | - } |
|
46 | - |
|
47 | - public function testInternalSchema(): void |
|
48 | - { |
|
49 | - $result = $this->executeGraphQLRequest('{bar foo}', [], 'internal'); |
|
50 | - $this->assertSame('bar', $result['data']['bar']); |
|
51 | - $this->assertSame('foo', $result['data']['foo']); |
|
52 | - $this->assertSchemaQueryTypeName('InternalQuery'); |
|
53 | - |
|
54 | - $result = $this->executeGraphQLRequest('{users{edges{node{username email}}}}', [], 'internal'); |
|
55 | - $this->assertSame([['node' => ['username' => 'user1', 'email' => 'topsecret']]], $result['data']['users']['edges']); |
|
56 | - |
|
57 | - $query = <<<'EOF' |
|
58 | - mutation M { |
|
59 | - addUser(input: {username: "user1"}) { |
|
60 | - user { |
|
61 | - username |
|
62 | ||
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - EOF; |
|
67 | - |
|
68 | - $expectedData = [ |
|
69 | - 'addUser' => [ |
|
70 | - 'user' => ['username' => 'user1', 'email' => 'email1'], |
|
71 | - ], |
|
72 | - ]; |
|
73 | - |
|
74 | - $this->assertGraphQL($query, $expectedData, null, [], 'internal'); |
|
75 | - } |
|
76 | - |
|
77 | - public function testUnknownTypeShouldThrowAnUnresolvableException(): void |
|
78 | - { |
|
79 | - // @phpstan-ignore-next-line |
|
80 | - $schema = $this->getContainer()->get('overblog_graphql.request_executor')->getSchema('public'); |
|
81 | - $this->expectException(UnresolvableException::class); |
|
82 | - $this->expectExceptionMessage('Could not find type with alias "unknown". Did you forget to define it?'); |
|
83 | - $schema->getType('unknown'); |
|
84 | - } |
|
85 | - |
|
86 | - private function assertSchemaQueryTypeName(string $typeName): void |
|
87 | - { |
|
88 | - // @phpstan-ignore-next-line |
|
89 | - $query = $this->getContainer()->get('overblog_graphql.type_resolver')->resolve($typeName); |
|
90 | - $this->assertSame('Query', $query->name); |
|
91 | - } |
|
92 | -} |
@@ -26,67 +26,3 @@ |
||
26 | 26 | $this->assertSame([['node' => ['username' => 'user1']]], $result['data']['users']['edges']); |
27 | 27 | |
28 | 28 | $query = <<<'EOF' |
29 | - mutation M { |
|
30 | - addUser(input: {username: "user1"}) { |
|
31 | - user { |
|
32 | - username |
|
33 | - } |
|
34 | - } |
|
35 | - } |
|
36 | - EOF; |
|
37 | - |
|
38 | - $expectedData = [ |
|
39 | - 'addUser' => [ |
|
40 | - 'user' => ['username' => 'user1'], |
|
41 | - ], |
|
42 | - ]; |
|
43 | - |
|
44 | - $this->assertGraphQL($query, $expectedData, null, [], 'public'); |
|
45 | - } |
|
46 | - |
|
47 | - public function testInternalSchema(): void |
|
48 | - { |
|
49 | - $result = $this->executeGraphQLRequest('{bar foo}', [], 'internal'); |
|
50 | - $this->assertSame('bar', $result['data']['bar']); |
|
51 | - $this->assertSame('foo', $result['data']['foo']); |
|
52 | - $this->assertSchemaQueryTypeName('InternalQuery'); |
|
53 | - |
|
54 | - $result = $this->executeGraphQLRequest('{users{edges{node{username email}}}}', [], 'internal'); |
|
55 | - $this->assertSame([['node' => ['username' => 'user1', 'email' => 'topsecret']]], $result['data']['users']['edges']); |
|
56 | - |
|
57 | - $query = <<<'EOF' |
|
58 | - mutation M { |
|
59 | - addUser(input: {username: "user1"}) { |
|
60 | - user { |
|
61 | - username |
|
62 | ||
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - EOF; |
|
67 | - |
|
68 | - $expectedData = [ |
|
69 | - 'addUser' => [ |
|
70 | - 'user' => ['username' => 'user1', 'email' => 'email1'], |
|
71 | - ], |
|
72 | - ]; |
|
73 | - |
|
74 | - $this->assertGraphQL($query, $expectedData, null, [], 'internal'); |
|
75 | - } |
|
76 | - |
|
77 | - public function testUnknownTypeShouldThrowAnUnresolvableException(): void |
|
78 | - { |
|
79 | - // @phpstan-ignore-next-line |
|
80 | - $schema = $this->getContainer()->get('overblog_graphql.request_executor')->getSchema('public'); |
|
81 | - $this->expectException(UnresolvableException::class); |
|
82 | - $this->expectExceptionMessage('Could not find type with alias "unknown". Did you forget to define it?'); |
|
83 | - $schema->getType('unknown'); |
|
84 | - } |
|
85 | - |
|
86 | - private function assertSchemaQueryTypeName(string $typeName): void |
|
87 | - { |
|
88 | - // @phpstan-ignore-next-line |
|
89 | - $query = $this->getContainer()->get('overblog_graphql.type_resolver')->resolve($typeName); |
|
90 | - $this->assertSame('Query', $query->name); |
|
91 | - } |
|
92 | -} |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @dataProvider specialTypeFieldProvider |
34 | 34 | */ |
35 | - public function testSpecialField($fieldName, ObjectType|UnionType|InterfaceType|CustomScalarType $typeWithSpecialField, callable $fieldValueRetriever = null, $strict = true): void |
|
35 | + public function testSpecialField($fieldName, ObjectType | UnionType | InterfaceType | CustomScalarType $typeWithSpecialField, callable $fieldValueRetriever = null, $strict = true): void |
|
36 | 36 | { |
37 | 37 | if (null === $fieldValueRetriever) { |
38 | - $fieldValueRetriever = fn (ObjectType|UnionType|InterfaceType|CustomScalarType $type, $fieldName) => $type->config[$fieldName]; |
|
38 | + $fieldValueRetriever = fn(ObjectType | UnionType | InterfaceType | CustomScalarType $type, $fieldName) => $type->config[$fieldName]; |
|
39 | 39 | } |
40 | 40 | $expected = static function (): void { |
41 | 41 | }; |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | yield 'toto' => ['type' => Type::boolean(), 'resolve' => null]; |
67 | 67 | }, |
68 | 68 | ]); |
69 | - $barResolver = static fn () => 'bar'; |
|
70 | - $bazResolver = static fn () => 'baz'; |
|
69 | + $barResolver = static fn() => 'bar'; |
|
70 | + $bazResolver = static fn() => 'baz'; |
|
71 | 71 | |
72 | 72 | $this->decorate( |
73 | 73 | [$objectType->name => $objectType], |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | [$objectType->name => $objectType], |
103 | 103 | [ |
104 | 104 | $objectType->name => [ |
105 | - 'bar' => fn ($value, $args) => $args, |
|
105 | + 'bar' => fn($value, $args) => $args, |
|
106 | 106 | ], |
107 | 107 | ] |
108 | 108 | ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | public function testCustomScalarTypeUnknownField(): void |
222 | 222 | { |
223 | - $customScalarType = new CustomScalarType(['name' => 'Foo', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => '']); |
|
223 | + $customScalarType = new CustomScalarType(['name' => 'Foo', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => '']); |
|
224 | 224 | $this->assertDecorateException( |
225 | 225 | [$customScalarType->name => $customScalarType], |
226 | 226 | [ |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | public function specialTypeFieldProvider(): array |
274 | 274 | { |
275 | - $objectWithResolveField = new ObjectType(['name' => 'Bar', 'fields' => [], 'resolveField' => fn () => '']); |
|
275 | + $objectWithResolveField = new ObjectType(['name' => 'Bar', 'fields' => [], 'resolveField' => fn() => '']); |
|
276 | 276 | |
277 | 277 | return [ |
278 | 278 | // isTypeOf |
@@ -281,18 +281,18 @@ discard block |
||
281 | 281 | [ |
282 | 282 | ResolverMapInterface::RESOLVE_FIELD, |
283 | 283 | $objectWithResolveField, |
284 | - fn (ObjectType $type) => $type->resolveFieldFn, |
|
284 | + fn(ObjectType $type) => $type->resolveFieldFn, |
|
285 | 285 | false, |
286 | 286 | ], |
287 | 287 | [ResolverMapInterface::RESOLVE_FIELD, $objectWithResolveField, null, false], |
288 | 288 | // resolveType |
289 | - [ResolverMapInterface::RESOLVE_TYPE, new UnionType(['name' => 'Baz', 'resolveType' => fn () => '', 'types' => []])], |
|
290 | - [ResolverMapInterface::RESOLVE_TYPE, new InterfaceType(['name' => 'Baz', 'fields' => [], 'resolveType' => fn (mixed $objectValue, mixed $context, ResolveInfo $resolveInfo): string => ''])], |
|
289 | + [ResolverMapInterface::RESOLVE_TYPE, new UnionType(['name' => 'Baz', 'resolveType' => fn() => '', 'types' => []])], |
|
290 | + [ResolverMapInterface::RESOLVE_TYPE, new InterfaceType(['name' => 'Baz', 'fields' => [], 'resolveType' => fn(mixed $objectValue, mixed $context, ResolveInfo $resolveInfo): string => ''])], |
|
291 | 291 | // custom scalar |
292 | - [ResolverMapInterface::SERIALIZE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => ''])], |
|
293 | - [ResolverMapInterface::PARSE_VALUE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => '', 'parseValue' => fn (mixed $input): mixed => ''])], |
|
294 | - [ResolverMapInterface::PARSE_LITERAL, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => '', 'parseLiteral' => fn (Node $a, array|null $b): mixed => ''])], |
|
295 | - [ResolverMapInterface::SCALAR_TYPE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn (mixed $input): mixed => ''])], |
|
292 | + [ResolverMapInterface::SERIALIZE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => ''])], |
|
293 | + [ResolverMapInterface::PARSE_VALUE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => '', 'parseValue' => fn(mixed $input): mixed => ''])], |
|
294 | + [ResolverMapInterface::PARSE_LITERAL, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => '', 'parseLiteral' => fn(Node $a, array | null $b): mixed => ''])], |
|
295 | + [ResolverMapInterface::SCALAR_TYPE, new CustomScalarType(['name' => 'Custom', 'scalarType' => Type::string(), 'serialize' => fn(mixed $input): mixed => ''])], |
|
296 | 296 | ]; |
297 | 297 | } |
298 | 298 |