Download the PHP package kunicmarko/graphql-test without Composer
On this page you can find all versions of the php package kunicmarko/graphql-test. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kunicmarko/graphql-test
More information about kunicmarko/graphql-test
Files in kunicmarko/graphql-test
Package graphql-test
Short Description GraphQL Test Cases
License MIT
Homepage https://github.com/kunicmarko20/graphql-test
Informations about the package graphql-test
GraphQL Test Case
Makes testing your GraphQL queries and mutations easier.
Support for Symfony, Lumen and Laravel.
Documentation
- Installation
- How to use
- Examples
- Query
- Mutation
Installation
1. Add dependency with composer
If you are using Symfony you will have to install "symfony/browser-kit".
How to use
Depending on your framework, extend the correct TestCase
:
Everything you see in the next snippets is the same for all Test Cases.
In your tests you now have 2 additional helper methods:
By default, endpoint is /graphql
, you can overwrite this by changing variable in your tests:
There is a helper method that allows you to preset headers:
Examples
Query
KunicMarko\GraphQLTest\Operation\Query
construct accepts 3 arguments:
- name of query (mandatory)
- parameters (optional)
- fields (optional)
Mutation
KunicMarko\GraphQLTest\Operation\Mutation
construct accepts 3 arguments:
- name of mutation (mandatory)
- parameters (optional)
- fields (optional)
If you have a Enum, Boolean or Array as an argument you can pass it as following:
Also, if you need a custom type you can always extend KunicMarko\GraphQLTest\Type\TypeInterface
and use your own Type instead.