GraphQLViewerEndpointTest.php in Open Social 10.0.x
File
modules/social_features/social_user/tests/src/Kernel/GraphQL/GraphQLViewerEndpointTest.php
View source
<?php
namespace Drupal\Tests\social_user\Kernel\GraphQL;
use Drupal\Tests\social_graphql\Kernel\SocialGraphQLTestBase;
class GraphQLViewerEndpointTest extends SocialGraphQLTestBase {
public static $modules = [
"social_user",
"role_delegation",
];
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',
]));
}
}