mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
SchemaParser: additional test case
This commit is contained in:
parent
a19fc3d208
commit
ccb9486d21
@ -200,6 +200,42 @@ extend type Hello {
|
|||||||
$this->assertEquals($expected, TestUtils::nodeToArray($doc));
|
$this->assertEquals($expected, TestUtils::nodeToArray($doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @it Extension without fields followed by extension
|
||||||
|
*/
|
||||||
|
public function testExtensionWithoutFieldsFollowedByExtension()
|
||||||
|
{
|
||||||
|
$body = '
|
||||||
|
extend type Hello implements Greeting
|
||||||
|
|
||||||
|
extend type Hello implements SecondGreeting
|
||||||
|
';
|
||||||
|
$doc = Parser::parse($body);
|
||||||
|
$expected = [
|
||||||
|
'kind' => 'Document',
|
||||||
|
'definitions' => [
|
||||||
|
[
|
||||||
|
'kind' => 'ObjectTypeExtension',
|
||||||
|
'name' => $this->nameNode('Hello', ['start' => 23, 'end' => 28]),
|
||||||
|
'interfaces' => [$this->typeNode('Greeting', ['start' => 40, 'end' => 48])],
|
||||||
|
'directives' => [],
|
||||||
|
'fields' => [],
|
||||||
|
'loc' => ['start' => 11, 'end' => 48],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'kind' => 'ObjectTypeExtension',
|
||||||
|
'name' => $this->nameNode('Hello', ['start' => 76, 'end' => 81]),
|
||||||
|
'interfaces' => [$this->typeNode('SecondGreeting', ['start' => 93, 'end' => 107])],
|
||||||
|
'directives' => [],
|
||||||
|
'fields' => [],
|
||||||
|
'loc' => ['start' => 64, 'end' => 107],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'loc' => ['start' => 0, 'end' => 116],
|
||||||
|
];
|
||||||
|
$this->assertEquals($expected, $doc->toArray(true));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @it Extension without anything throws
|
* @it Extension without anything throws
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user