Skip to content

Commit

Permalink
closes #147
Browse files Browse the repository at this point in the history
  • Loading branch information
viniychuk committed Jun 7, 2017
1 parent 23fbf30 commit 9a80b8c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion Tests/Schema/VariablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,27 @@ public function testInvalidNullableList()
$processor->processPayload(
'query getList($ids: [ID!]) { list(ids: $ids) }',
[
'ids' => [1, 12, null]
'ids' => [1, 12]
]
);
$this->assertEquals(['data' => ['list' => 'item']], $processor->getResponseData());

$processor->getExecutionContext()->clearErrors();
$processor->processPayload(
'query getList($ids: [ID!]) { list(ids: $ids) }',
[
'ids' => [1, 12, null]
]
);
$this->assertEquals(['data' => ['list' => null], 'errors' => [
[
'message' => 'Not valid type for argument "ids" in query "list"',
'locations' => [
['line' => 1, 'column' => 35]
]
],
]], $processor->getResponseData());

$processor->getExecutionContext()->clearErrors();
$processor->processPayload(
'query getList($ids: [ID]) { list(ids: $ids) }',
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/ResolveValidator/ResolveValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function assertValidArguments(FieldInterface $field, AstFieldInterface $q
case TypeMap::KIND_SCALAR:
case TypeMap::KIND_INPUT_OBJECT:
case TypeMap::KIND_LIST:
if (!$argument->getType()->isValidValue($argumentType->parseValue($astArgument->getValue()))) {
if (!$argument->getType()->isValidValue($astArgument->getValue())) {
$error = $argument->getType()->getLastError();
throw new ResolveException($error ? $error : sprintf('Not valid type for argument "%s" in query "%s"', $astArgument->getName(), $field->getName()), $astArgument->getLocation());
}
Expand Down

0 comments on commit 9a80b8c

Please sign in to comment.