You are here

public function GraphQLViewerEndpointTest::testViewerLoadsCurrentUser in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php \Drupal\Tests\social_user\Kernel\GraphQL\GraphQLViewerEndpointTest::testViewerLoadsCurrentUser()
  2. 10.0.x modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php \Drupal\Tests\social_user\Kernel\GraphQL\GraphQLViewerEndpointTest::testViewerLoadsCurrentUser()
  3. 10.2.x modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php \Drupal\Tests\social_user\Kernel\GraphQL\GraphQLViewerEndpointTest::testViewerLoadsCurrentUser()

It loads the current user.

File

modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php, line 27

Class

GraphQLViewerEndpointTest
Tests the root viewer endpoint.

Namespace

Drupal\Tests\social_user\Kernel\GraphQL

Code

public function testViewerLoadsCurrentUser() : void {
  $user = $this
    ->createUser();
  $this
    ->setCurrentUser($user);
  $this
    ->assertResults("\n        query {\n          viewer {\n            id\n          }\n        }\n      ", [], [
    'viewer' => [
      'id' => $user
        ->uuid(),
    ],
  ], $this
    ->defaultCacheMetaData()
    ->setCacheMaxAge(0)
    ->addCacheableDependency($user)
    ->addCacheContexts([
    'languages:language_interface',
  ]));
}