You are here

public function QaAccountsCreateDelete::createQaAccounts in QA Accounts 8

Creates QA accounts for all existing roles.

Overrides QaAccountsCreateDeleteInterface::createQaAccounts

File

src/QaAccountsCreateDelete.php, line 43

Class

QaAccountsCreateDelete
Service that creates and deletes QA accounts for roles.

Namespace

Drupal\qa_accounts

Code

public function createQaAccounts() {
  $roles = $this->entityTypeManager
    ->getStorage('user_role')
    ->loadMultiple();
  foreach ($roles as $role_name => $role) {
    if ($role_name === 'anonymous') {
      continue;
    }
    $this
      ->createQaAccountForRole($role_name);
  }
}