You are here

public function MassPasswordTestBase::getUserObjectsFromAccountsPage in Mass Password Change 8

Get User objects from current Accounts (/admin/people) page.

Return value

\Drupal\user\UserInterface[] Accounts array.

2 calls to MassPasswordTestBase::getUserObjectsFromAccountsPage()
MassPasswordReset::testBlockedUserMassPasswordReset in tests/src/Functional/MassPasswordReset.php
Test Password reset function with blocked user.
MassPasswordTestBase::setUp in tests/src/Functional/MassPasswordTestBase.php
Set up a privileged user.

File

tests/src/Functional/MassPasswordTestBase.php, line 71

Class

MassPasswordTestBase
Test base class for mass_password_change module.

Namespace

Drupal\Tests\mass_password_change\Functional

Code

public function getUserObjectsFromAccountsPage() {
  $accounts = [];
  $domElements = $this
    ->getSession()
    ->getPage()
    ->findAll('css', '.views-field-name a.username');
  foreach ($domElements as $domElement) {

    /** @var \Drupal\user\UserInterface $account */
    $account = user_load_by_name($domElement
      ->getText());
    $accounts[$account
      ->id()] = $account;
  }
  return $accounts;
}