protected function WorkbenchAccessTestTrait::createUserWithRole in Workbench Access 8
Sets up a user with a given role and saves it.
Parameters
string $rid: The role id.
Return value
\Drupal\user\Entity\User The user entity.
4 calls to WorkbenchAccessTestTrait::createUserWithRole()
- AccessByUserFormTest::doFormTests in tests/
src/ Functional/ AccessByUserFormTest.php - Test the form with the given section.
- AssignUserFormTest::testAssignUserForm in tests/
src/ Functional/ AssignUserFormTest.php - Tests that the AssignUserForm works correctly.
- WorkbenchAccessTestTrait::setUpAdminUser in tests/
src/ Traits/ WorkbenchAccessTestTrait.php - Sets up a user with an editor role that has access to content.
- WorkbenchAccessTestTrait::setUpEditorUser in tests/
src/ Traits/ WorkbenchAccessTestTrait.php - Sets up a user with an editor role that has access to content.
File
- tests/
src/ Traits/ WorkbenchAccessTestTrait.php, line 140
Class
- WorkbenchAccessTestTrait
- Contains helper classes for tests to set up various configuration.
Namespace
Drupal\Tests\workbench_access\TraitsCode
protected function createUserWithRole($rid) {
$user = $this
->createUser();
$user
->addRole($rid);
$user
->save();
return $user;
}