public function PermissionsTest::testFullQueryAccess in GraphQL 8.4
Same name and namespace in other branches
- 8.3 tests/src/Kernel/Framework/PermissionsTest.php \Drupal\Tests\graphql\Kernel\Framework\PermissionsTest::testFullQueryAccess()
Test access to arbitrary queries.
The user is allowed to post any queries.
File
- tests/
src/ Kernel/ Framework/ PermissionsTest.php, line 58
Class
- PermissionsTest
- Test if query handling respects permissions properly.
Namespace
Drupal\Tests\graphql\Kernel\FrameworkCode
public function testFullQueryAccess() : void {
$this
->setUpCurrentUser([], [
"execute {$this->server->id()} arbitrary graphql requests",
]);
// All queries should work.
$this
->assertEquals(200, $this
->query('{ root }')
->getStatusCode());
$batched = $this
->batchedQueries([
[
'query' => '{ root }',
],
[
'query' => '{ root }',
],
]);
$this
->assertEquals(200, $batched
->getStatusCode());
$data = [
'data' => [
'root' => 'test',
],
];
$this
->assertEquals([
$data,
$data,
], json_decode($batched
->getContent(), TRUE));
}