Codeception的GraphQL扩展
v0.5.0
2023-04-10 14:36 UTC
Requires
- php: >=8.1
- codeception/codeception: ^2.1 || ^3.1.3 || ^4.1.22 || ^5.0
- euautomation/graphql-client: 0.2 || ^0.3 || dev-master
README
一个用于调用GraphQL端点的Codeception扩展
这需要一个运行的服务器,如果需要,可以使用Codeception PhpBuiltInServer。
安装
composer require zestic/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()); } }