InvalidPayloadTest.php in GraphQL 8.3
File
tests/src/Kernel/Framework/InvalidPayloadTest.php
View source
<?php
namespace Drupal\Tests\graphql\Kernel\Framework;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Symfony\Component\HttpFoundation\Request;
class InvalidPayloadTest extends GraphQLTestBase {
public function testEmptyPayload() {
$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",
],
]));
}
}