GitHunt
ZE

zestic/codeception-graphql

A codeception extension for calling graphql endpoints

Codeception GraphQL

A codeception extension for calling GraphQL endpoints

This requires a running server, you can use Codeception PhpBuiltInServer
if needed.

Installation

composer require zestic/codeception-graphql --dev

To configure

In your acceptance.suite.yml file

modules:
    enabled:
        - GraphQL:
            url: 'http://localhost:8080/'

Testing

To use it in a test

class PingCest
{
    public function testPing(AcceptanceTester $I)
    {
        $query = 'query{ping {response}}';
        $I->sendGraphQL($query);
        $expected = [
            'ping' => [
                'response' => 'pong',
            ],
        ];
        $I->assertEquals($expected, $I->grabResponseData());
    }
}

Languages

PHP100.0%
MIT License
Created March 25, 2018
Updated March 21, 2023
zestic/codeception-graphql | GitHunt