diff --git a/backend/app/plugins/wiaas/tests/unit-tests/test-wiaas-rest-customer-api.php b/backend/app/plugins/wiaas/tests/unit-tests/test-wiaas-rest-customer-api.php index 85844e4..ba5f79f 100644 --- a/backend/app/plugins/wiaas/tests/unit-tests/test-wiaas-rest-customer-api.php +++ b/backend/app/plugins/wiaas/tests/unit-tests/test-wiaas-rest-customer-api.php @@ -205,10 +205,7 @@ class Wiass_REST_Customer_Api_Test extends Wiaas_Unit_Test_Case { $address_id = self::insert_dummy_billing_address(); wp_set_current_user(0); - $request = new WP_REST_Request( 'POST', '/wiaas/customer/1/billing-addresses'); - $request->set_body_params(array( - 'address_id' => $address_id - )); + $request = new WP_REST_Request( 'DELETE', '/wiaas/customer/1/billing-addresses/' . $address_id); $response = $this->server->dispatch( $request ); $this->assertNotNull($response); @@ -227,10 +224,7 @@ class Wiass_REST_Customer_Api_Test extends Wiaas_Unit_Test_Case { $address_id = self::insert_dummy_billing_address(); wp_set_current_user(1); - $request = new WP_REST_Request( 'POST', '/wiaas/customer/1/billing-addresses'); - $request->set_body_params(array( - 'address_id' => $address_id - )); + $request = new WP_REST_Request( 'DELETE', '/wiaas/customer/1/billing-addresses/' . $address_id); $response = $this->server->dispatch( $request ); $this->assertNotNull($response); @@ -260,10 +254,7 @@ class Wiass_REST_Customer_Api_Test extends Wiaas_Unit_Test_Case { $address_id = self::insert_dummy_profile_address(); wp_set_current_user(0); - $request = new WP_REST_Request( 'POST', '/wiaas/customer/1/profile-addresses'); - $request->set_body_params(array( - 'address_id' => $address_id - )); + $request = new WP_REST_Request( 'DELETE', '/wiaas/customer/1/profile-addresses/' . $address_id); $response = $this->server->dispatch( $request ); $this->assertNotNull($response); @@ -282,10 +273,7 @@ class Wiass_REST_Customer_Api_Test extends Wiaas_Unit_Test_Case { $address_id = self::insert_dummy_profile_address(); wp_set_current_user(1); - $request = new WP_REST_Request( 'POST', '/wiaas/customer/1/profile-addresses'); - $request->set_body_params(array( - 'address_id' => $address_id - )); + $request = new WP_REST_Request( 'DELETE', '/wiaas/customer/1/profile-addresses/' . $address_id); $response = $this->server->dispatch( $request ); $this->assertNotNull($response); @@ -598,12 +586,12 @@ class Wiass_REST_Customer_Api_Test extends Wiaas_Unit_Test_Case { $dummy_address = self::create_dummy_address(); - $request = new WP_REST_Request( 'PUT', '/wiaas/customer/1/delivery-addresses'); + $request = new WP_REST_Request( 'PUT', '/wiaas/customer/1/profile-addresses'); $request->set_body_params(array( - 'delivery_address' => json_encode($dummy_address) + 'profile_address' => json_encode($dummy_address) )); $response = $this->server->dispatch( $request ); - return $response->get_data()['data']['delivery_addresses'][0]['id']; + return $response->get_data()['data']['profile_addresses'][0]['id']; } }