lastdragon-ru/phpunit-graphql
PHPUnit helpers for testing GraphQL in PHP apps. Provides assertions and utilities to execute queries/mutations, validate responses, and compare errors/data structures, aimed at simplifying reliable GraphQL API test coverage.
graphql-php/graphql-server or similar).lastdragon-ru/graphql-printer (or a similar printer utility), this package provides assertion utilities to validate GraphQL output, reducing manual parsing/validation efforts.filamentphp/graphql or webonyx/graphql-php.lastdragon-ru/graphql-printer (or a compatible printer) and PHPUnit. If these are not present, additional setup is needed.webonyx/graphql-php's built-in printer).graphql-printer; if the printer’s output format changes, assertions may break.graphql-php/graphql-testing) insufficient? How does this package improve test coverage or developer experience?lastdragon-ru/graphql-printer already in use, or will a new dependency be introduced? What’s the fallback if the printer changes?composer require.webonyx/graphql-php, filamentphp/graphql).graphql-php/graphql-server's built-in printer), assertions may fail unless adapted.refreshDatabase(), actingAs()) alongside GraphQL tests.graphql-printer isn’t used, evaluate whether to adopt it or find a compatible alternative.use LastDragon\PhpUnitGraphQL\Assertions\GraphQLAssertions;
$this->get('/graphql')
->assertGraphQLQueryMatches('{ user { id name } }', [
'user' => ['id' => '1', 'name' => 'Test User']
]);
^9.5 or ^10.0).phpunit Artisan commands, no changes needed.composer require lastdragon-ru/phpunit-graphql lastdragon-ru/graphql-printer.--debug to catch assertion failures early.graphql-printer for breaking changes.composer.json to avoid surprises.--verbose to diagnose assertion failures.pest or PHPUnit parallelization).| Failure Type | Impact | Mitigation |
|---|---|---|
| Printer Output Changes | Assertions break without warning. | Pin printer version; test with schema updates. |
| Unmaintained Package | No fixes for bugs/feature requests. | Fork or replace with graphql-testing. |
| Schema Evolution | Tests fail due to field renames. | Use schema snapshots or versioned tests. |
| PHPUnit Version Conflict | Package incompatible with Laravel’s PHPUnit. | Check compatibility matrix early. |
assertJson checks.How can I help you explore Laravel packages today?