You are here

function UserImportWebTestCase::tearDown in User Import 7

Same name and namespace in other branches
  1. 8 user_import.test \UserImportWebTestCase::tearDown()
  2. 6.4 user_import.test \UserImportWebTestCase::tearDown()
  3. 6.2 user_import.test \UserImportWebTestCase::tearDown()
  4. 7.3 user_import.test \UserImportWebTestCase::tearDown()
  5. 7.2 user_import.test \UserImportWebTestCase::tearDown()

SimpleTest core method: code run after each and every test method.

Overrides DrupalWebTestCase::tearDown

File

./user_import.test, line 109

Class

UserImportWebTestCase
User Import module base test class.

Code

function tearDown() {

  // delete accounts of users imported
  $users_email = $this
    ->usersList();
  foreach ($users_email as $mail) {
    $account = user_load_by_mail($mail);
    if (!empty($account)) {
      user_delete($account->uid);
    }
  }

  // delete the import
  $import_id = $this
    ->importID();
  $this
    ->assertTrue(!empty($import_id), t('Import ID: !id', array(
    '!id' => $import_id,
  )));
  _user_import_settings_deletion($import_id);

  // Always call the tearDown() function from the parent class.
  parent::tearDown();
}