function UserImportNodeprofileTestCase::tearDown in User Import 6.2
Same name and namespace in other branches
- 6.4 user_import.test \UserImportNodeprofileTestCase::tearDown()
SimpleTest core method: code run after each and every test method.
Overrides UserImportWebTestCase::tearDown
File
- ./
user_import.test, line 379
Class
- UserImportNodeprofileTestCase
- Test import of user data into Profile module
Code
function tearDown() {
// delete accounts of users imported
$users_email = $this
->usersList();
foreach ($users_email as $mail) {
$account = user_load(array(
'mail' => $mail,
));
// delete node profile nodes
if (!empty($account)) {
$identity = node_load(array(
'type' => 'identity',
'uid' => $account->uid,
));
$biography = node_load(array(
'type' => 'biography',
'uid' => $account->uid,
));
$contact_details = node_load(array(
'type' => 'contact_details',
'uid' => $account->uid,
));
node_delete($identity->nid);
node_delete($biography->nid);
node_delete($contact_details->nid);
user_delete(array(), $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);
// delete vocabulary
taxonomy_del_vocabulary($this->vocabulary_id);
// uninstall modules
// - tear down disable doesn't seem to do this
// foreach($this->modules as $module) {
// if (function_exists($module . '_uninstall')) {
// $result = call_user_func_array($module . '_uninstall', array());
// }
// }
// delete nodeprofile content types
node_type_delete('dummy');
// (for some reason) the first node_type_delete is completely ignored
node_type_delete('identity');
node_type_delete('biography');
node_type_delete('contact_details');
// Always call the tearDown() function from the parent class.
parent::tearDown();
}