for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Youshido\Tests\Issues\Issue171;
use Youshido\GraphQL\Execution\Processor;
class Issue171Test extends \PHPUnit_Framework_TestCase
{
public function testItSetsDeprecationReasonToNullByDefault()
$schema = new Issue171Schema();
$processor = new Processor($schema);
$processor->processPayload($this->getIntrospectionQuery(), []);
$resp = $processor->getResponseData();
$enumTypes = array_filter($resp['data']['__schema']['types'], function($type){
return ($type['kind'] === 'ENUM');
});
foreach ($enumTypes as $enumType) {
foreach ($enumType['enumValues'] as $value) {
$this->assertFalse($value['isDeprecated']);
$this->assertNull($value['deprecationReason'], "deprecationReason should have been null");
}
private function getIntrospectionQuery()
return <<<TEXT
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
types {
...FullType
directives {
name
description
args {
...InputValue
onOperation
onFragment
onField
fragment FullType on __Type {
kind
fields {
type {
...TypeRef
isDeprecated
deprecationReason
inputFields {
interfaces {
enumValues {
possibleTypes {
fragment InputValue on __InputValue {
type { ...TypeRef }
defaultValue
fragment TypeRef on __Type {
ofType {
TEXT;