xaddax/codeception-graphql

此包已被弃用,不再维护。作者建议使用zestic/codeception-graphql包。

Codeception 的 GraphQL 扩展

0.3.0 2020-03-31 04:21 UTC

This package is auto-updated.

Last update: 2022-10-20 05:37:33 UTC


README

## 不再受支持,请使用 zestic/codeception-graphql 代替

Codeception GraphQL

用于调用 GraphQL 端点的 Codeception 扩展

这需要一个运行的服务器,如果需要,可以使用 Codeception PhpBuiltInServer

安装

composer require xaddax/codeception-graphql --dev

配置方法

在您的 acceptance.suite.yml 文件中

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

测试

在测试中使用它

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