public function InvalidPayloadTest::testEmptyPayload in GraphQL 8.3
Same name and namespace in other branches
- 8.4 tests/src/Kernel/Framework/InvalidPayloadTest.php \Drupal\Tests\graphql\Kernel\Framework\InvalidPayloadTest::testEmptyPayload()
File
- tests/
src/ Kernel/ Framework/ InvalidPayloadTest.php, line 15
Class
- InvalidPayloadTest
- Invalid payloads should not trigger a PHP error, but be handled as empty.
Namespace
Drupal\Tests\graphql\Kernel\FrameworkCode
public function testEmptyPayload() {
/** @var \Symfony\Component\HttpFoundation\Response $result */
$result = $this->container
->get('http_kernel')
->handle(Request::create('/graphql', 'POST', [], [], [], [], '{ invalid'));
$this
->assertJson($result
->getContent(), json_encode([
'errors' => [
'message' => "GraphQL Request must include at least one of those two parameters: \\u0022query\\u0022 or \\u0022queryId\\u0022\"",
'category' => "request",
],
]));
}