From 9b50d7adf6d99101d157dfe6cc49ce14f475786d Mon Sep 17 00:00:00 2001 From: Mathieu Rochette Date: Thu, 14 Mar 2024 10:13:23 +0100 Subject: [PATCH] test: Add test that reproduce issue #1165 --- tests/Config/Parser/MetadataParserTest.php | 3 ++- tests/Config/Parser/fixtures/annotations/Type/Battle.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Config/Parser/MetadataParserTest.php b/tests/Config/Parser/MetadataParserTest.php index 8342ce0e5..329fa8f8f 100644 --- a/tests/Config/Parser/MetadataParserTest.php +++ b/tests/Config/Parser/MetadataParserTest.php @@ -459,8 +459,9 @@ public function testArgsAndReturnGuessing(): void 'planet' => ['type' => 'PlanetInput', 'defaultValue' => null], 'away' => ['type' => 'Boolean', 'defaultValue' => false], 'maxDistance' => ['type' => 'Float', 'defaultValue' => null], + 'cases' => ['type' => '[String!]!'], ], - 'resolve' => '@=call(value.getCasualties, arguments({raceId: "String!", areaId: "Int!", dayStart: "Int", dayEnd: "Int", nameStartingWith: "String", planet: "PlanetInput", away: "Boolean", maxDistance: "Float"}, args))', + 'resolve' => '@=call(value.getCasualties, arguments({raceId: "String!", cases: "[String!]!", areaId: "Int!", dayStart: "Int", dayEnd: "Int", nameStartingWith: "String", planet: "PlanetInput", away: "Boolean", maxDistance: "Float"}, args))', 'complexity' => '@=childrenComplexity * 5', ], ], diff --git a/tests/Config/Parser/fixtures/annotations/Type/Battle.php b/tests/Config/Parser/fixtures/annotations/Type/Battle.php index 30be8b833..ee43a764f 100644 --- a/tests/Config/Parser/fixtures/annotations/Type/Battle.php +++ b/tests/Config/Parser/fixtures/annotations/Type/Battle.php @@ -23,9 +23,11 @@ final class Battle * @GQL\Field(name="casualties", complexity="childrenComplexity * 5") * * @GQL\Arg(name="raceId", type="String!", description="A race ID") + * @GQL\Arg(name="cases", type="[String!]!") */ #[GQL\Field(name: 'casualties', complexity: 'childrenComplexity * 5')] #[GQL\Arg(name: 'raceId', type: 'String!', description: 'A race ID')] + #[GQL\Arg(name: 'cases', type: '[String!]!')] public function getCasualties( int $areaId, ?string $raceId, @@ -34,7 +36,8 @@ public function getCasualties( string $nameStartingWith = '', Planet $planet = null, bool $away = false, - float $maxDistance = null + float $maxDistance = null, + array $cases = [] ): ?int { return 12; }