-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve validation message when using output types as inputs
- Loading branch information
Showing
4 changed files
with
40 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Tests\Integration\Schema; | ||
|
||
use GraphQL\Error\InvariantViolation; | ||
use Nuwave\Lighthouse\Schema\Validator as SchemaValidator; | ||
use Tests\TestCase; | ||
|
||
final class ValidatorTest extends TestCase | ||
{ | ||
public function testOutputTypeUsedAsInput(): void | ||
{ | ||
$this->schema = /** @lang GraphQL */ ' | ||
type Query { | ||
foo(foo: Foo): Int | ||
} | ||
type Foo { | ||
foo: Int | ||
} | ||
'; | ||
|
||
$schemaValidator = $this->app->make(SchemaValidator::class); | ||
|
||
$this->expectExceptionObject(new InvariantViolation('The type of Query.foo(foo:) must be Input Type but got: Foo.')); | ||
$schemaValidator->validate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters