handle user roles by organization

This commit is contained in:
Almira Krdzic
2018-10-11 04:16:43 +02:00
parent 9a8e05e341
commit 84cd11f9c9
29 changed files with 1341 additions and 124 deletions

View File

@@ -28,6 +28,8 @@ class Wiaas_Order_Test extends Wiaas_Unit_Test_Case {
Wiaas_User_Organization::TAXONOMY_NAME
)['term_id'];
update_user_meta($this->customer_id, '_wiaas_organization_id', $this->customer_organization_id);
# add customer to organization
wp_set_terms_for_user(
$this->customer_id,
@@ -198,28 +200,4 @@ class Wiaas_Order_Test extends Wiaas_Unit_Test_Case {
$this->assertArrayHasKey('email', $transformed_order_response['commercial_lead']);
$this->assertArrayHasKey('phone', $transformed_order_response['commercial_lead']);
}
/**
* @covers Wiaas_Order::transform_rest_order()
*/
function test_order_rest_response_has_empty_documents_when_package_has_no_documents() {
$order_response = array(
'customer_id' => $this->customer_id,
'status' => 'processing',
'line_items' => array()
);
$request = array( 'id' => $this->order_id);
$order_rest_response = new WP_REST_Response($order_response);
$order_rest_response = Wiaas_Order::transform_rest_order(
$order_rest_response,
wc_get_order($this->order_id),
$request);
$transformed_order_response = $order_rest_response->get_data();
$this->assertNotNull($transformed_order_response['documents']);
$this->assertTrue(is_array($transformed_order_response['documents']));
}
}