Handle order project and refactor api
This commit is contained in:
@@ -24,6 +24,8 @@ class Wiaas_Unit_Test_Case extends WP_UnitTestCase {
|
||||
Wiaas_Product_Category::register_product_categories();
|
||||
|
||||
Wiaas_Package_Type::register_package_type_taxonomy();
|
||||
|
||||
Wiaas_Order_Project::register_order_project_taxonomy();
|
||||
|
||||
define('WP_TEST_IN_PROGRESS',true);
|
||||
}
|
||||
@@ -85,4 +87,28 @@ class Wiaas_Unit_Test_Case extends WP_UnitTestCase {
|
||||
|
||||
$package->sync(true);
|
||||
}
|
||||
|
||||
function create_new_customer($login = 'customer_test', $organization_name = 'test-customer-organization') {
|
||||
$customer_id = wp_insert_user(array(
|
||||
'user_login' => $login,
|
||||
'user_pass' => 'test',
|
||||
'user_email' => $login . '@mail.com',
|
||||
'role' => 'customer',
|
||||
));
|
||||
|
||||
$organization = get_term_by('name', $organization_name, Wiaas_User_Organization::TAXONOMY_NAME);
|
||||
if (is_wp_error($organization)) {
|
||||
$organization = wp_insert_term(
|
||||
$organization_name,
|
||||
Wiaas_User_Organization::TAXONOMY_NAME
|
||||
);
|
||||
}
|
||||
|
||||
wp_set_terms_for_user(
|
||||
$customer_id,
|
||||
Wiaas_User_Organization::TAXONOMY_NAME,
|
||||
[$organization_name]);
|
||||
|
||||
return $customer_id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user