trait UserCreationTrait in SimpleTest 8.3
Provides methods to create additional test users and switch the currently logged in one.
This trait is meant to be used only by test classes extending \Drupal\simpletest\TestBase.
Hierarchy
- trait \Drupal\simpletest\UserCreationTrait uses UserCreationTrait
Deprecated
in Drupal 8.4.x. Will be removed before Drupal 9.0.0. Use Drupal\Tests\user\Traits\UserCreationTrait instead.
See also
https://www.drupal.org/node/2884454
File
- src/
UserCreationTrait.php, line 21
Namespace
Drupal\simpletestView source
trait UserCreationTrait {
use BaseUserCreationTrait;
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UserCreationTrait:: |
protected | function | Checks whether a given list of permission names is valid. | |
UserCreationTrait:: |
protected | function | Creates an administrative role. | |
UserCreationTrait:: |
protected | function | Creates a role with specified permissions. | |
UserCreationTrait:: |
protected | function | Create a user with a given set of permissions. | |
UserCreationTrait:: |
protected | function | Grant permissions to a user role. | |
UserCreationTrait:: |
protected | function | Switch the current logged in user. | |
UserCreationTrait:: |
protected | function | Creates a random user account and sets it as current user. |