lastdragon-ru/lara-asp-graphql-testing
Testing helpers for GraphQL in Laravel apps using lara-asp. Provides utilities and assertions to build requests, execute queries/mutations, and validate responses in automated tests, making GraphQL endpoint testing faster and more reliable.
lastdragon-ru/lara-asp-graphql, a GraphQL layer for Laravel. If the product relies on GraphQL for API contracts, this package provides a structured way to validate queries, mutations, and schema outputs in tests—critical for API-driven architectures.tests/Feature/GraphQLTest.php). No additional test runner or framework is required.composer require and extending PHPUnit test classes. No database migrations, service providers, or complex configurations.lara-asp-graphql, so integration assumes the parent package is already in use. If not, this package offers limited standalone value.@auth directives).lara-asp-graphql updates.graphql-php/graphql-testing, spatie/laravel-graphql-testing) that offer broader compatibility?lara-asp-graphql. No conflicts with Laravel’s service container or Blade templates.lastdragon-ru/lara-asp-graphql (for schema execution).nuwave/lighthouse (if considering alternatives).assertContains, assertJson) to quantify improvements.GraphQLQueryTest.php) to validate assertions work as expected.use LastDragon\LaraAspGraphQLTesting\Assertions;
public function test_query_returns_expected_fields()
{
$response = $this->graphQL('{ user { id name } }');
Assertions::assertQueryReturnsFields($response, ['user' => ['id', 'name']]);
}
assertNoSchemaErrors).lara-asp-graphql’s Laravel version support (e.g., 8.x, 9.x). This package likely mirrors that.@deprecated, @auth).assertSchemaContainsType).lara-asp-graphql for breaking changes. Consider forking if the package is abandoned.beforeEach to reset state or mock dependencies.$this->graphQL('{ user { ... } }')->dump(); // Log full response
--parallel).assertSchemaMatchesSnapshot).| Failure Type | Impact | Mitigation |
|---|---|---|
| Package abandonment | Broken assertions, no updates | Fork or switch to alternatives (e.g., graphql-php/graphql-testing). |
| Schema drift | Tests fail due to undocumented changes | Enforce schema reviews via PR checks. |
| False positives | Tests pass but queries fail in prod | Add integration tests with real GraphQL clients. |
| CI flakiness | Intermittent test failures | Retry mechanisms or mock external dependencies. |
| Over-reliance on assertions | Tests become brittle | Balance with manual testing and documentation. |
assertQueryReturnsFields).How can I help you explore Laravel packages today?