Skip to content

Commit

Permalink
test: Add test that reproduce issue #1165
Browse files Browse the repository at this point in the history
  • Loading branch information
mathroc committed Mar 14, 2024
1 parent 501193b commit 9b50d7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/Config/Parser/MetadataParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
],
Expand Down
5 changes: 4 additions & 1 deletion tests/Config/Parser/fixtures/annotations/Type/Battle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}
Expand Down

0 comments on commit 9b50d7a

Please sign in to comment.