trait UserCreationTrait
Same name in this branch
- 8.9.x core/modules/user/tests/src/Traits/UserCreationTrait.php \Drupal\Tests\user\Traits\UserCreationTrait
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Traits/UserCreationTrait.php \Drupal\Tests\user\Traits\UserCreationTrait
- 10 core/modules/user/tests/src/Traits/UserCreationTrait.php \Drupal\Tests\user\Traits\UserCreationTrait
- 9 core/modules/user/tests/src/Traits/UserCreationTrait.php \Drupal\Tests\user\Traits\UserCreationTrait
- main 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 \Drupal\Tests\user\Traits\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
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| 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. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.