You are here

public function UserPermissionsContextTest::testUserPermissionsContext in GraphQL 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Kernel/Framework/UserPermissionsContextTest.php \Drupal\Tests\graphql\Kernel\Framework\UserPermissionsContextTest::testUserPermissionsContext()

Assert user.permissions tag on results.

File

tests/src/Kernel/Framework/UserPermissionsContextTest.php, line 20

Class

UserPermissionsContextTest
Verify that all queries declare the user.permissions cache context.

Namespace

Drupal\Tests\graphql\Kernel\Framework

Code

public function testUserPermissionsContext() {
  $this
    ->mockField('root', [
    'name' => 'root',
    'type' => 'String',
  ], 'test');
  $result = $this
    ->query('query { root }');
  $this
    ->assertContains('user.permissions', $result
    ->getCacheableMetadata()
    ->getCacheContexts());
}