|
3 | 3 | namespace GraphQL\Tests\Utils;
|
4 | 4 |
|
5 | 5 | use GraphQL\Error\DebugFlag;
|
6 |
| -use GraphQL\Error\Error; |
7 | 6 | use GraphQL\GraphQL;
|
8 | 7 | use GraphQL\Language\Parser;
|
9 | 8 | use GraphQL\Utils\BuildSchema;
|
|
14 | 13 | * Their counterparts have been removed from `buildASTSchema-test.js` and moved elsewhere,
|
15 | 14 | * but these changes to `graphql-js` haven't been reflected in `graphql-php` yet.
|
16 | 15 | * TODO align with:
|
17 |
| - * - https://github.com/graphql/graphql-js/commit/3b9ea61f2348215dee755f779caef83df749d2bb |
18 | 16 | * - https://github.com/graphql/graphql-js/commit/64a5c3448a201737f9218856786c51d66f2deabd.
|
19 | 17 | */
|
20 | 18 | class BuildSchemaLegacyTest extends TestCase
|
@@ -145,177 +143,4 @@ interface Character {
|
145 | 143 | $result = GraphQL::executeQuery($schema, $source, $rootValue);
|
146 | 144 | self::assertEquals($expected, $result->toArray(DebugFlag::INCLUDE_DEBUG_MESSAGE));
|
147 | 145 | }
|
148 |
| - |
149 |
| - // Describe: Failures |
150 |
| - |
151 |
| - /** |
152 |
| - * @see it('Unknown type referenced') |
153 |
| - */ |
154 |
| - public function testUnknownTypeReferenced(): void |
155 |
| - { |
156 |
| - $this->expectExceptionObject(BuildSchema::unknownType('Bar')); |
157 |
| - $sdl = ' |
158 |
| - schema { |
159 |
| - query: Hello |
160 |
| - } |
161 |
| - |
162 |
| - type Hello { |
163 |
| - bar: Bar |
164 |
| - } |
165 |
| - '; |
166 |
| - $doc = Parser::parse($sdl); |
167 |
| - $schema = BuildSchema::buildAST($doc); |
168 |
| - $schema->getTypeMap(); |
169 |
| - } |
170 |
| - |
171 |
| - /** |
172 |
| - * @see it('Unknown type in interface list') |
173 |
| - */ |
174 |
| - public function testUnknownTypeInInterfaceList(): void |
175 |
| - { |
176 |
| - $this->expectExceptionObject(BuildSchema::unknownType('Bar')); |
177 |
| - $sdl = ' |
178 |
| - type Query implements Bar { |
179 |
| - field: String |
180 |
| - } |
181 |
| - '; |
182 |
| - $doc = Parser::parse($sdl); |
183 |
| - $schema = BuildSchema::buildAST($doc); |
184 |
| - $schema->getTypeMap(); |
185 |
| - } |
186 |
| - |
187 |
| - /** |
188 |
| - * @see it('Unknown type in union list') |
189 |
| - */ |
190 |
| - public function testUnknownTypeInUnionList(): void |
191 |
| - { |
192 |
| - $this->expectExceptionObject(BuildSchema::unknownType('Bar')); |
193 |
| - $sdl = ' |
194 |
| - union TestUnion = Bar |
195 |
| - type Query { testUnion: TestUnion } |
196 |
| - '; |
197 |
| - $doc = Parser::parse($sdl); |
198 |
| - $schema = BuildSchema::buildAST($doc); |
199 |
| - $schema->getTypeMap(); |
200 |
| - } |
201 |
| - |
202 |
| - /** |
203 |
| - * @see it('Unknown query type') |
204 |
| - */ |
205 |
| - public function testUnknownQueryType(): void |
206 |
| - { |
207 |
| - $this->expectException(Error::class); |
208 |
| - $this->expectExceptionMessage('Specified query type "Wat" not found in document.'); |
209 |
| - $sdl = ' |
210 |
| - schema { |
211 |
| - query: Wat |
212 |
| - } |
213 |
| - |
214 |
| - type Hello { |
215 |
| - str: String |
216 |
| - } |
217 |
| - '; |
218 |
| - $doc = Parser::parse($sdl); |
219 |
| - BuildSchema::buildAST($doc); |
220 |
| - } |
221 |
| - |
222 |
| - /** |
223 |
| - * @see it('Unknown mutation type') |
224 |
| - */ |
225 |
| - public function testUnknownMutationType(): void |
226 |
| - { |
227 |
| - $this->expectException(Error::class); |
228 |
| - $this->expectExceptionMessage('Specified mutation type "Wat" not found in document.'); |
229 |
| - $sdl = ' |
230 |
| - schema { |
231 |
| - query: Hello |
232 |
| - mutation: Wat |
233 |
| - } |
234 |
| - |
235 |
| - type Hello { |
236 |
| - str: String |
237 |
| - } |
238 |
| - '; |
239 |
| - $doc = Parser::parse($sdl); |
240 |
| - BuildSchema::buildAST($doc); |
241 |
| - } |
242 |
| - |
243 |
| - /** |
244 |
| - * @see it('Unknown subscription type') |
245 |
| - */ |
246 |
| - public function testUnknownSubscriptionType(): void |
247 |
| - { |
248 |
| - $this->expectException(Error::class); |
249 |
| - $this->expectExceptionMessage('Specified subscription type "Awesome" not found in document.'); |
250 |
| - $sdl = ' |
251 |
| - schema { |
252 |
| - query: Hello |
253 |
| - mutation: Wat |
254 |
| - subscription: Awesome |
255 |
| - } |
256 |
| - |
257 |
| - type Hello { |
258 |
| - str: String |
259 |
| - } |
260 |
| - |
261 |
| - type Wat { |
262 |
| - str: String |
263 |
| - } |
264 |
| - '; |
265 |
| - $doc = Parser::parse($sdl); |
266 |
| - BuildSchema::buildAST($doc); |
267 |
| - } |
268 |
| - |
269 |
| - /** |
270 |
| - * @see it('Does not consider directive names') |
271 |
| - */ |
272 |
| - public function testDoesNotConsiderDirectiveNames(): void |
273 |
| - { |
274 |
| - $sdl = ' |
275 |
| - schema { |
276 |
| - query: Foo |
277 |
| - } |
278 |
| - |
279 |
| - directive @Foo on QUERY |
280 |
| - '; |
281 |
| - $doc = Parser::parse($sdl); |
282 |
| - $this->expectExceptionMessage('Specified query type "Foo" not found in document.'); |
283 |
| - BuildSchema::build($doc); |
284 |
| - } |
285 |
| - |
286 |
| - /** |
287 |
| - * @see it('Does not consider operation names') |
288 |
| - */ |
289 |
| - public function testDoesNotConsiderOperationNames(): void |
290 |
| - { |
291 |
| - $this->expectException(Error::class); |
292 |
| - $this->expectExceptionMessage('Specified query type "Foo" not found in document.'); |
293 |
| - $sdl = ' |
294 |
| - schema { |
295 |
| - query: Foo |
296 |
| - } |
297 |
| - |
298 |
| - query Foo { field } |
299 |
| - '; |
300 |
| - $doc = Parser::parse($sdl); |
301 |
| - BuildSchema::buildAST($doc); |
302 |
| - } |
303 |
| - |
304 |
| - /** |
305 |
| - * @see it('Does not consider fragment names') |
306 |
| - */ |
307 |
| - public function testDoesNotConsiderFragmentNames(): void |
308 |
| - { |
309 |
| - $this->expectException(Error::class); |
310 |
| - $this->expectExceptionMessage('Specified query type "Foo" not found in document.'); |
311 |
| - $sdl = ' |
312 |
| - schema { |
313 |
| - query: Foo |
314 |
| - } |
315 |
| - |
316 |
| - fragment Foo on Type { field } |
317 |
| - '; |
318 |
| - $doc = Parser::parse($sdl); |
319 |
| - BuildSchema::buildAST($doc); |
320 |
| - } |
321 | 146 | }
|
0 commit comments