public function PermissionsTest::testNoPermissions 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::testNoPermissions()
Test if a user without permissions doesn't have access to any query.
File
- tests/
src/ Kernel/ Framework/ PermissionsTest.php, line 38
Class
- PermissionsTest
- Test if query handling respects permissions properly.
Namespace
Drupal\Tests\graphql\Kernel\FrameworkCode
public function testNoPermissions() : void {
$this
->setUpCurrentUser();
// Any query should fail.
$this
->assertEquals(403, $this
->query('query')
->getStatusCode());
$batched = $this
->batchedQueries([
[
'query' => '{ root }',
],
[
'query' => '{ root }',
],
]);
// If all batched queries fail, 403 is returned.
$this
->assertEquals(403, $batched
->getStatusCode());
}