You are here

public function MassPasswordReset::testBlockedUserMassPasswordReset in Mass Password Change 8

Test Password reset function with blocked user.

File

tests/src/Functional/MassPasswordReset.php, line 83

Class

MassPasswordReset
Test the password reset function.

Namespace

Drupal\Tests\mass_password_change\Functional

Code

public function testBlockedUserMassPasswordReset() {
  $blocked_account = $this
    ->drupalCreateUser()
    ->block();
  $blocked_account
    ->save();
  $this
    ->drupalGet('/admin/people');
  $accounts = $this
    ->getUserObjectsFromAccountsPage();
  $weight = $this
    ->getUserWeightFromAccountsArray($accounts, $blocked_account
    ->id());
  $edit = [
    'action' => 'mass_password_reset_action',
    "user_bulk_form[{$weight}]" => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Apply to selected items');
  $this
    ->assertText(sprintf("No access to execute Password reset the selected user(s) on the User %s.", $blocked_account
    ->getAccountName()));
}