Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/Validator/QueryComplexityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ public function testFragmentQueries(): void
$this->assertDocumentValidators($query, 2, 3);
}

/** @dataProvider fragmentQueriesOnRootProvider */
public function testFragmentQueriesOnRoot(string $query): void
{
$this->assertDocumentValidators($query, 12, 13);
}

/** @return iterable<array<string>> */
public function fragmentQueriesOnRootProvider(): iterable
{
yield ['fragment humanFragment on QueryRoot { human { dogs { name } } } query { ...humanFragment }']; // success example
yield ['query { ...humanFragment } fragment humanFragment on QueryRoot { human { dogs { name } } }']; // failing example, changed order see https://github.com/webonyx/graphql-php/issues/785
}

public function testAliasesQueries(): void
{
$query = 'query MyQuery { thomas: human(name: "Thomas") { firstName } jeremy: human(name: "Jeremy") { firstName } }';
Expand Down
Loading