Ejemplo n.º 1
0
    /**
     * @it Simple input object
     */
    public function testSimpleInputObject()
    {
        $body = '
input Hello {
  world: String
}';
        $doc = Parser::parse($body);
        $loc = function ($start, $end) {
            return TestUtils::locArray($start, $end);
        };
        $expected = ['kind' => NodeKind::DOCUMENT, 'definitions' => [['kind' => NodeKind::INPUT_OBJECT_TYPE_DEFINITION, 'name' => $this->nameNode('Hello', $loc(7, 12)), 'directives' => [], 'fields' => [$this->inputValueNode($this->nameNode('world', $loc(17, 22)), $this->typeNode('String', $loc(24, 30)), null, $loc(17, 30))], 'loc' => $loc(1, 32)]], 'loc' => $loc(0, 32)];
        $this->assertEquals($expected, TestUtils::nodeToArray($doc));
    }
Ejemplo n.º 2
0
 /**
  * @param Node $node
  * @return array
  */
 public static function nodeToArray(Node $node)
 {
     return TestUtils::nodeToArray($node);
 }