You are here

public function MassPasswordReset::testCurrentUserMassPasswordReset in Mass Password Change 8

Test Password reset function for current user.

File

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

Class

MassPasswordReset
Test the password reset function.

Namespace

Drupal\Tests\mass_password_change\Functional

Code

public function testCurrentUserMassPasswordReset() {
  $current_user_weight = $this
    ->getUserWeightFromAccountsArray($this->accounts, $this->adminUser
    ->id());
  $this
    ->drupalGet('/admin/people');
  $edit = [
    'action' => 'mass_password_reset_action',
    "user_bulk_form[{$current_user_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.", $this->adminUser
    ->getAccountName()));
}