Download the PHP package zestic/pest-plugin-graphql without Composer
On this page you can find all versions of the php package zestic/pest-plugin-graphql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pest-plugin-graphql
Pest GraphQL Plugin
Test your GraphQL API in style, with Pest!
Installation
Simply install through Composer!
In your .env
file, set the testing url
To organize your tests, create an Api
directory in your tests
directory.
Make sure your namespace is set up correctly in the composer.json
file.
Finally, in your Pest.php file add the following line:
What's Added?
- Test your schema as code;
- Assert PSR-7 GraphQL response data and errors;
- Testing resolvers (Coming Soon!);
Expectations
schema(string|Schema $document)
isValidSdl()
toHaveDirective(string $directive)
toHaveEnum(string $enum)
toHaveInput(string $input)
toHaveInterface(string $interface)
toHaveScalar(string $scalar)
toHaveType(string $type)
toHaveUnion(string $union)
toBeGraphQlResponse()
toHavePath(string $path, $value = null)
toHaveData(array $data)
toHaveErrors(array $errors)
And more on the way!
schema(string|Schema $document)
Create a new expectation with a GraphQL\Type\Schema
instance as the underlying
value.
You can also provide an alternative schema path or document contents, like so.
isValidSdl()
Assert that the schema is valid and written to the GraphQL specification.
toHaveDirective(string $directive)
Assert that the given directive definition exists with the schema document.
toHaveEnum(string $enum)
Assert that the given enum definition exists with the schema document.
toHaveInput(string $input)
Assert that the given input definition exists with the schema document.
toHaveInterface(string $interface)
Assert that the given interface definition exists with the schema document.
toHaveScalar(string $scalar)
Assert that the given scalar definition exists with the schema document.
toHaveType(string $type)
Assert that the given (object) type has been defined within the schema document.
toHaveUnion(string $union)
Assert that the given union definition exists with the schema document.
toBeGraphQlResponse()
Assert that an underlying (PSR-7) response value is a compliant with the GraphQL specification.
toHavePath(string $path, $value = null)
Assert that the underlying GraphQL response contains data at the given path. Optionally provide a value to be checked as well!
toHaveData(array $data)
Assert that the underlying response GraphQL data is canonically equal to the expected data.
toHaveErrors(array $errors)
Assert that the underlying response GraphQL errors are canonically equal to the expected set of errors.
This repository was based off of the Pest Plugin Template.
Pest was created by Nuno Maduro under the Sponsorware license. It got open-sourced and is now licensed under the MIT license.
All versions of pest-plugin-graphql with dependencies
pestphp/pest Version ^2.0
pestphp/pest-plugin Version ^2.0.1
psr/http-message Version ^1.0
webonyx/graphql-php Version >=15
zestic/graphql-simple-client Version ^0.1.0