You are here

public function DemoUmamiProfileTest::testUser in Drupal 9

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php \Drupal\Tests\demo_umami\Functional\DemoUmamiProfileTest::testUser()

Tests that the users can log in with the admin password selected at install.

File

core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php, line 97

Class

DemoUmamiProfileTest
Tests demo_umami profile.

Namespace

Drupal\Tests\demo_umami\Functional

Code

public function testUser() {
  $password = $this->rootUser->pass_raw;
  $ids = \Drupal::entityQuery('user')
    ->accessCheck(FALSE)
    ->condition('roles', [
    'author',
    'editor',
  ], 'IN')
    ->execute();
  $users = \Drupal::entityTypeManager()
    ->getStorage('user')
    ->loadMultiple($ids);
  foreach ($users as $user) {
    $this
      ->drupalLoginWithPassword($user, $password);
  }
}