mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 15:59:24 +03:00
Add nested nullable test in VariablesInAllowedPosition
This commit is contained in:
parent
804daa188e
commit
672ff0b7d6
@ -219,6 +219,14 @@ abstract class ValidatorTestCase extends TestCase
|
|||||||
'type' => Type::string(),
|
'type' => Type::string(),
|
||||||
'args' => ['stringListArg' => ['type' => Type::listOf(Type::string())]],
|
'args' => ['stringListArg' => ['type' => Type::listOf(Type::string())]],
|
||||||
],
|
],
|
||||||
|
'stringListNonNullArgField' => [
|
||||||
|
'type' => Type::string(),
|
||||||
|
'args' => [
|
||||||
|
'stringListNonNullArg' => [
|
||||||
|
'type' => Type::listOf(Type::nonNull(Type::string())),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
'complexArgField' => [
|
'complexArgField' => [
|
||||||
'type' => Type::string(),
|
'type' => Type::string(),
|
||||||
'args' => ['complexArg' => ['type' => $ComplexInput]],
|
'args' => ['complexArg' => ['type' => $ComplexInput]],
|
||||||
@ -276,9 +284,15 @@ abstract class ValidatorTestCase extends TestCase
|
|||||||
|
|
||||||
$anyScalar = new CustomScalarType([
|
$anyScalar = new CustomScalarType([
|
||||||
'name' => 'Any',
|
'name' => 'Any',
|
||||||
'serialize' => function ($value) { return $value; },
|
'serialize' => function ($value) {
|
||||||
'parseLiteral' => function ($node) { return $node; }, // Allows any value
|
return $value;
|
||||||
'parseValue' => function ($value) { return $value; }, // Allows any value
|
},
|
||||||
|
'parseLiteral' => function ($node) {
|
||||||
|
return $node;
|
||||||
|
}, // Allows any value
|
||||||
|
'parseValue' => function ($value) {
|
||||||
|
return $value;
|
||||||
|
}, // Allows any value
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$queryRoot = new ObjectType([
|
$queryRoot = new ObjectType([
|
||||||
|
@ -368,4 +368,26 @@ class VariablesInAllowedPositionTest extends ValidatorTestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @it [String] => [String!]
|
||||||
|
*/
|
||||||
|
public function testStringArrayXStringNonNullArray()
|
||||||
|
{
|
||||||
|
$this->expectFailsRule(
|
||||||
|
new VariablesInAllowedPosition,
|
||||||
|
'
|
||||||
|
query Query($stringListVar: [String])
|
||||||
|
{
|
||||||
|
complicatedArgs {
|
||||||
|
stringListNonNullArgField(stringListNonNullArg: $stringListVar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
', [
|
||||||
|
FormattedError::create(
|
||||||
|
VariablesInAllowedPosition::badVarPosMessage('stringListVar', '[String]', '[String!]'),
|
||||||
|
[new SourceLocation(2, 19), new SourceLocation(5, 59)]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user