// Assign the role to the user.
$this->drupalGet('user/' . $account->id() . '/edit'); $this->submitForm(["roles[{$rid}]" => $rid], 'Save'); $this->assertSession()->pageTextContains('The changes have been saved.'); $this->assertSession()->checkboxChecked('edit-roles-' . $rid); $this->userLoadAndCheckRoleAssigned($account, $rid);
// Remove the role from the user.
$this->drupalGet('user/' . $account->id() . '/edit'); $this->submitForm(["roles[{$rid}]" => FALSE], 'Save'); $this->assertSession()->pageTextContains('The changes have been saved.'); $this->assertSession()->checkboxNotChecked('edit-roles-' . $rid); $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE); }
/**
* Tests assigning a role at user creation and removing the role.
*/