diff --git a/tests/functional/BasicCest.php b/tests/functional/BasicCest.php index 8ad7cdf..68c3f69 100644 --- a/tests/functional/BasicCest.php +++ b/tests/functional/BasicCest.php @@ -62,4 +62,37 @@ public function testCanSendPOST( FunctionalTester $I ) { ]); } + + /** + * wp-graphql sends graphql requests to index.php?graphql + */ + public function testCanSendPOSTToGraphiql( FunctionalTester $I ) { + + $query = ' + { + languages { + code + } + }'; + + $I->haveHttpHeader( 'Content-Type', 'application/json' ); + $I->sendPOST( '/index.php?graphql', [ + 'query' => $query, + ] ); + $I->seeResponseCodeIs( 200 ); + $I->seeResponseIsJson(); + $I->seeResponseContainsJson([ + 'data' => [ + 'languages' => [ + [ + 'code' => 'EN', + ], + [ + 'code' => 'FI', + ] + ], + ], + ]); + + } } \ No newline at end of file