Fix assigment order issues
This commit is contained in:
@@ -22,28 +22,18 @@ class Wiaas_User_Organization_Test extends Wiaas_Unit_Test_Case {
|
||||
|
||||
$this->user_department_name = 'test_department';
|
||||
|
||||
# create organization
|
||||
$this->user_organization_id = wp_insert_term(
|
||||
$this->user_organization_name,
|
||||
Wiaas_User_Organization::TAXONOMY_NAME
|
||||
)['term_id'];
|
||||
// create organization
|
||||
$this->user_organization_id = $this->factory->organization->create_new_organization(
|
||||
array( 'name' => $this->user_organization_name )
|
||||
);
|
||||
|
||||
update_user_meta($this->user_id, '_wiaas_organization_id', $this->user_organization_id);
|
||||
// create department
|
||||
$this->user_department_id = $this->factory->organization->create_new_organization(
|
||||
array( 'name' => $this->user_department_name, 'parent_id' => $this->user_organization_id )
|
||||
);
|
||||
|
||||
# create department
|
||||
$this->user_department_id = wp_insert_term(
|
||||
$this->user_department_name,
|
||||
Wiaas_User_Organization::TAXONOMY_NAME,
|
||||
array(
|
||||
'parent' => $this->user_organization_id
|
||||
)
|
||||
)['term_id'];
|
||||
|
||||
# assign user to organization
|
||||
wp_set_terms_for_user(
|
||||
$this->user_id,
|
||||
Wiaas_User_Organization::TAXONOMY_NAME,
|
||||
[$this->user_organization_name]);
|
||||
// assign user to organization
|
||||
$this->factory->organization->assign_user_to_organization($this->user_id, $this->user_organization_id);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
@@ -53,12 +43,7 @@ class Wiaas_User_Organization_Test extends Wiaas_Unit_Test_Case {
|
||||
|
||||
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);
|
||||
$this->factory->organization->delete_organizations();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user