public function GraphQLViewerEndpointTest::testViewerLoadsCurrentUser in Open Social 10.1.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php \Drupal\Tests\social_user\Kernel\GraphQL\GraphQLViewerEndpointTest::testViewerLoadsCurrentUser()
- 10.0.x modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php \Drupal\Tests\social_user\Kernel\GraphQL\GraphQLViewerEndpointTest::testViewerLoadsCurrentUser()
- 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\GraphQLCode
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',
]));
}