Skip to content

Commit

Permalink
test for parser
Browse files Browse the repository at this point in the history
  • Loading branch information
viniychuk committed Jun 3, 2017
1 parent d0d561b commit 5b27235
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/Parser/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,4 +823,21 @@ public function testVariablesInQuery()
$this->assertArrayNotHasKey('errors', $data);
}

public function testVariableDefaultValue()
{
$parser = new Parser();
$parsedStructure = $parser->parse('
query ($format: String = "small"){
user {
avatar(format: $format)
}
}
');
/** @var Variable $var */
$var = $parsedStructure['variables'][0];
$this->assertTrue($var->hasDefaultValue());
$this->assertEquals('small', $var->getDefaultValue()->getValue());
$this->assertEquals('small', $var->getValue()->getValue());
}

}

0 comments on commit 5b27235

Please sign in to comment.