mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-21 20:36:05 +03:00
Test complete validation
This commit is contained in:
parent
800d8ba25f
commit
3dec7a9995
@ -343,11 +343,11 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
|
||||
|
||||
function expectPassesCompleteValidation($queryString)
|
||||
{
|
||||
$this->expectValid($this->getDefaultSchema(), $this->getAllRules(), $queryString);
|
||||
$this->expectValid($this->getDefaultSchema(), DocumentValidator::allRules(), $queryString);
|
||||
}
|
||||
|
||||
function expectFailsCompleteValidation($queryString, $errors)
|
||||
{
|
||||
$this->expectInvalid($this->getDefaultSchema(), $this->getAllRules(), $queryString, $errors);
|
||||
$this->expectInvalid($this->getDefaultSchema(), DocumentValidator::allRules(), $queryString, $errors);
|
||||
}
|
||||
}
|
||||
|
30
tests/Validator/ValidationTest.php
Normal file
30
tests/Validator/ValidationTest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace GraphQL\Tests\Validator;
|
||||
|
||||
use GraphQL\Language\Parser;
|
||||
use GraphQL\Utils\TypeInfo;
|
||||
use GraphQL\Validator\DocumentValidator;
|
||||
|
||||
class ValidationText extends TestCase
|
||||
{
|
||||
// Validate: Supports full validation
|
||||
|
||||
/**
|
||||
* @it validates queries
|
||||
*/
|
||||
public function testValidatesQueries()
|
||||
{
|
||||
$this->expectPassesCompleteValidation('
|
||||
query {
|
||||
catOrDog {
|
||||
... on Cat {
|
||||
furColor
|
||||
}
|
||||
... on Dog {
|
||||
isHousetrained
|
||||
}
|
||||
}
|
||||
}
|
||||
');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user