|
24 | 24 | use TheCodingMachine\GraphQLite\Fixtures\TestControllerWithInvalidReturnType; |
25 | 25 | use TheCodingMachine\GraphQLite\Fixtures\TestControllerWithIterableParam; |
26 | 26 | use TheCodingMachine\GraphQLite\Fixtures\TestControllerWithIterableReturnType; |
| 27 | +use TheCodingMachine\GraphQLite\Fixtures\TestFieldBadOutputType; |
27 | 28 | use TheCodingMachine\GraphQLite\Fixtures\TestObject; |
28 | 29 | use TheCodingMachine\GraphQLite\Fixtures\TestSelfType; |
| 30 | +use TheCodingMachine\GraphQLite\Fixtures\TestSourceFieldBadOutputType; |
| 31 | +use TheCodingMachine\GraphQLite\Fixtures\TestSourceFieldBadOutputType2; |
29 | 32 | use TheCodingMachine\GraphQLite\Fixtures\TestType; |
30 | 33 | use TheCodingMachine\GraphQLite\Fixtures\TestTypeId; |
31 | 34 | use TheCodingMachine\GraphQLite\Fixtures\TestTypeMissingAnnotation; |
|
36 | 39 | use TheCodingMachine\GraphQLite\Containers\EmptyContainer; |
37 | 40 | use TheCodingMachine\GraphQLite\Containers\BasicAutoWiringContainer; |
38 | 41 | use TheCodingMachine\GraphQLite\Mappers\CannotMapTypeException; |
| 42 | +use TheCodingMachine\GraphQLite\Mappers\CannotMapTypeExceptionInterface; |
39 | 43 | use TheCodingMachine\GraphQLite\Reflection\CachedDocBlockFactory; |
40 | 44 | use TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface; |
41 | 45 | use TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface; |
@@ -488,4 +492,28 @@ public function testSourceFieldWithFailWith() |
488 | 492 |
|
489 | 493 | $this->assertInstanceOf(StringType::class, $fields['test']->getType()); |
490 | 494 | } |
| 495 | + |
| 496 | + public function testSourceFieldBadOutputTypeException() |
| 497 | + { |
| 498 | + $queryProvider = $this->buildFieldsBuilder(); |
| 499 | + $this->expectException(CannotMapTypeExceptionInterface::class); |
| 500 | + $this->expectExceptionMessage('For @SourceField "test" declared in "TheCodingMachine\GraphQLite\Fixtures\TestSourceFieldBadOutputType", cannot find GraphQL type "[NotExists]". Check your TypeMapper configuration.'); |
| 501 | + $queryProvider->getFields(new TestSourceFieldBadOutputType(), true); |
| 502 | + } |
| 503 | + |
| 504 | + public function testSourceFieldBadOutputType2Exception() |
| 505 | + { |
| 506 | + $queryProvider = $this->buildFieldsBuilder(); |
| 507 | + $this->expectException(CannotMapTypeExceptionInterface::class); |
| 508 | + $this->expectExceptionMessage('For @SourceField "test" declared in "TheCodingMachine\GraphQLite\Fixtures\TestSourceFieldBadOutputType2", Syntax Error: Expected ], found <EOF>'); |
| 509 | + $queryProvider->getFields(new TestSourceFieldBadOutputType2(), true); |
| 510 | + } |
| 511 | + |
| 512 | + public function testBadOutputTypeException() |
| 513 | + { |
| 514 | + $queryProvider = $this->buildFieldsBuilder(); |
| 515 | + $this->expectException(CannotMapTypeExceptionInterface::class); |
| 516 | + $this->expectExceptionMessage('For return type of TheCodingMachine\GraphQLite\Fixtures\TestFieldBadOutputType::test, cannot find GraphQL type "[NotExists]". Check your TypeMapper configuration.'); |
| 517 | + $queryProvider->getFields(new TestFieldBadOutputType(), true); |
| 518 | + } |
491 | 519 | } |
0 commit comments