You are here

class GraphQLViewerEndpointTest in Open Social 10.3.x

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

Tests the root viewer endpoint.

@group social_graphql

Hierarchy

  • class \Drupal\Tests\social_user\Kernel\GraphQL\GraphQLViewerEndpointTest extends \Drupal\Tests\social_graphql\Kernel\SocialGraphQLTestBase

Expanded class hierarchy of GraphQLViewerEndpointTest

File

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

Namespace

Drupal\Tests\social_user\Kernel\GraphQL
View source
class GraphQLViewerEndpointTest extends SocialGraphQLTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    "social_user",
    // User creation in social_user requires a service in role_delegation.
    // TODO: Possibly untangle this?
    "role_delegation",
  ];

  /**
   * It loads the current user.
   */
  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',
    ]));
  }

}

Members