You are here

public function QaAccountsCreateDelete::deleteQaAccounts in QA Accounts 8

Deletes QA accounts.

Overrides QaAccountsCreateDeleteInterface::deleteQaAccounts

File

src/QaAccountsCreateDelete.php, line 91

Class

QaAccountsCreateDelete
Service that creates and deletes QA accounts for roles.

Namespace

Drupal\qa_accounts

Code

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