Handle tear down for unit tests

This commit is contained in:
Almira Krdzic
2018-08-14 12:12:54 +02:00
parent bb3fecd811
commit 3cc72d6d84
5 changed files with 39 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ class Wiaas_User_Organization_Test extends Wiaas_Unit_Test_Case {
$this->user_id = wp_create_user('test', 'test', 'test@mail.com');
$this->user_organization_name = 'test_organization';
$this->user_department_name = 'test-department';
$this->user_department_name = 'test_department';
# create organization
$this->user_organization_id = wp_insert_term(
@@ -44,6 +44,21 @@ class Wiaas_User_Organization_Test extends Wiaas_Unit_Test_Case {
[$this->user_organization_name]);
}
function tearDown() {
parent::tearDown();
wp_set_current_user(1);
wp_delete_user($this->user_id);
wp_delete_term(
$this->user_organization_id,
Wiaas_User_Organization::TAXONOMY_NAME);
wp_delete_term(
$this->user_department_id,
Wiaas_User_Organization::TAXONOMY_NAME);
}
/**
* @covers Wiaas_User_Organization::get_user_organization()
*/