PHPackages                             cjweber/laravel-test-graphql-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. cjweber/laravel-test-graphql-client

ActiveLibrary[Testing &amp; Quality](/categories/testing)

cjweber/laravel-test-graphql-client
===================================

Client and TestCase extension for running integration tests on requests to your GraphQL API

v1.0.4(3y ago)46.4k4BSD-3-ClausePHPPHP &gt;=7.0

Since Sep 4Pushed 3y ago2 watchersCompare

[ Source](https://github.com/cjweber/laravel-test-graphql-client)[ Packagist](https://packagist.org/packages/cjweber/laravel-test-graphql-client)[ RSS](/packages/cjweber-laravel-test-graphql-client/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (1)Versions (5)Used By (0)

Laravel GraphQL Test Client
===========================

[](#laravel-graphql-test-client)

This is a package which allows you to create integration tests against your GraphQL API easily and quickly.

Requirements
------------

[](#requirements)

```
1. Laravel 6.0 + / PHP 7.0 +
2. PHPUnit 8.0 +
3. GraphQL setup on your Laravel server, via https://github.com/rebing/graphql-laravel or other

```

What's inside
-------------

[](#whats-inside)

```
1. Basic GraphQL Client
2. Extension of TestCase which allows for access to the GraphQL client within your tests

```

Installation
------------

[](#installation)

`composer require cjweber/laravel-test-graphql-client --dev`

Usage
-----

[](#usage)

```
1. Extend the package TestCase for your feature test in order to leverage the included GraphQL Client
2. Make queries against your GraphQL by constructing a Query object and then passing it to the `graphql` property on your TestCase class
3. Use the `assertGraphQlFields` function in the package to test that the server returned the fields you expect. You can also do any other assertions that come with PHPUnit against the response data returned by the client.

```

Example
-------

[](#example)

```
