Test complete validation

This commit is contained in:
vladar 2016-04-25 19:50:03 +06:00
parent 800d8ba25f
commit 3dec7a9995
2 changed files with 32 additions and 2 deletions

View File

@ -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);
}
}

View 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
}
}
}
');
}
}