You are here

trait AdminUserTrait in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/AdminUserTrait.php \Drupal\Tests\video_embed_field\Functional\AdminUserTrait

Create admin users.

Hierarchy

3 files declare their use of AdminUserTrait
BundleTest.php in modules/video_embed_media/tests/src/Functional/BundleTest.php
TextFormatConfigurationTest.php in modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php
UpgradePathTest.php in modules/video_embed_media/tests/src/Functional/UpgradePathTest.php

File

tests/src/Functional/AdminUserTrait.php, line 10

Namespace

Drupal\Tests\video_embed_field\Functional
View source
trait AdminUserTrait {
  use UserCreationTrait;

  /**
   * Create an admin user.
   *
   * @return \Drupal\user\UserInterface
   *   A user with all permissions.
   */
  protected function createAdminUser() {
    return $this
      ->drupalCreateUser(array_keys($this->container
      ->get('user.permissions')
      ->getPermissions()));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AdminUserTrait::createAdminUser protected function Create an admin user.
UserCreationTrait::checkPermissions protected function Checks whether a given list of permission names is valid.
UserCreationTrait::createAdminRole protected function Creates an administrative role.
UserCreationTrait::createRole protected function Creates a role with specified permissions.
UserCreationTrait::createUser protected function Create a user with a given set of permissions.
UserCreationTrait::grantPermissions protected function Grant permissions to a user role.
UserCreationTrait::setCurrentUser protected function Switch the current logged in user.
UserCreationTrait::setUpCurrentUser protected function Creates a random user account and sets it as current user.