GraphQL\Tests\Language\SchemaParserTest::testSimpleFieldWithArgWithDefaultValue PHP Method

testSimpleFieldWithArgWithDefaultValue() public method

    public function testSimpleFieldWithArgWithDefaultValue()
    {
        $body = '
type Hello {
  world(flag: Boolean = true): String
}';
        $doc = Parser::parse($body);
        $loc = function ($start, $end) {
            return TestUtils::locArray($start, $end);
        };
        $expected = ['kind' => NodeKind::DOCUMENT, 'definitions' => [['kind' => NodeKind::OBJECT_TYPE_DEFINITION, 'name' => $this->nameNode('Hello', $loc(6, 11)), 'interfaces' => [], 'directives' => [], 'fields' => [$this->fieldNodeWithArgs($this->nameNode('world', $loc(16, 21)), $this->typeNode('String', $loc(45, 51)), [$this->inputValueNode($this->nameNode('flag', $loc(22, 26)), $this->typeNode('Boolean', $loc(28, 35)), ['kind' => NodeKind::BOOLEAN, 'value' => true, 'loc' => $loc(38, 42)], $loc(22, 42))], $loc(16, 51))], 'loc' => $loc(1, 53)]], 'loc' => $loc(0, 53)];
        $this->assertEquals($expected, TestUtils::nodeToArray($doc));
    }