Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Lara Asp Graphql Testing

Lara Asp Graphql Testing Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Useful assertions for PHPUnit to check printed/exported type/queries and more.

Frequently asked questions about Lara Asp Graphql Testing
How do I install this package for Laravel GraphQL testing?
Run `composer require --dev lastdragon-ru/lara-asp-graphql-testing` in your project. It’s designed for development use only and requires PHP 8.3–8.5 and PHPUnit 11.2–13. Ensure you’re using `lastdragon-ru/lara-asp-graphql` as your GraphQL layer.
Which Laravel versions does this package support?
This package is framework-agnostic but requires PHP 8.3–8.5 and PHPUnit 11.2–13. It’s compatible with any Laravel version that supports these PHP/PHPUnit constraints, as it integrates via PHPUnit assertions. No Laravel-specific dependencies exist.
Can I use this package with Pest instead of PHPUnit?
No, this package is built for PHPUnit only. If you use Pest, you’d need to manually adapt the assertions or explore alternatives like `spatie/laravel-graphql-testing`, which may offer broader framework support.
What assertions are available for GraphQL schema validation?
The package provides `assertGraphQLIntrospectionEquals` (client-facing schema), `assertGraphQLSchemaEquals` (internal schema), and `assertGraphQLSchemaNoBreakingChanges` (schema regression testing). These help validate schema structure, directives, and backward compatibility.
How do I test GraphQL queries and mutations with this package?
Extend your test class with the `Assertions` trait and use methods like `assertQueryReturnsFields` or `assertMutationReturnsData`. Example: `$this->assertQueryReturnsFields($response, ['user' => ['id', 'name']])`. It works with `lara-asp-graphql`’s response objects.
Does this package support testing GraphQL subscriptions?
No, the package currently focuses on queries and mutations. Subscriptions require real-time testing (e.g., WebSocket connections), which isn’t covered. For subscriptions, consider manual testing or tools like Laravel Echo or custom event listeners.
How do I handle authentication in GraphQL tests with this package?
This package doesn’t include auth-specific assertions. Use Laravel’s built-in auth helpers (e.g., `actingAs`) or middleware in your test setup. For GraphQL auth (e.g., `@auth` directives), manually validate token headers or roles in your test responses.
What if my GraphQL schema is dynamic (e.g., generated via ORM)?
The package works best with static schemas (SDL-first). For dynamic schemas, you may need custom assertions to validate runtime-generated types or fields. Document your schema’s behavior and extend the package’s assertions as needed.
Are there alternatives to this package for Laravel GraphQL testing?
Yes, consider `graphql-php/graphql-testing` (language-agnostic) or `spatie/laravel-graphql-testing` (Laravel-focused). These may offer broader compatibility, especially if you’re not using `lara-asp-graphql`. Evaluate based on your GraphQL layer and testing needs.
How do I integrate this into CI/CD pipelines?
Add the package to your `composer.json` dev dependencies and run PHPUnit tests as usual. The assertions add minimal overhead and integrate seamlessly with Laravel’s test suite. Monitor test coverage for schema changes to catch breaking updates early.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit