trait UserCreationTrait in Drupal 8
Same name in this branch
- 8 core/modules/simpletest/src/UserCreationTrait.php \Drupal\simpletest\UserCreationTrait
- 8 core/modules/user/tests/src/Traits/UserCreationTrait.php \Drupal\Tests\user\Traits\UserCreationTrait
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.0 and is removed from drupal:9.0.0. Use Drupal\Tests\user\Traits\UserCreationTrait instead.
See also
https://www.drupal.org/node/2884454
File
- core/
modules/ simpletest/ 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. |