From fffe7fdfdca03cb2f85ae1e304686e1269d86528 Mon Sep 17 00:00:00 2001 From: mushood Date: Thu, 15 Sep 2022 18:21:18 +0200 Subject: [PATCH 1/4] delete customer by id --- src/Api/Customers.php | 12 ++++++++++++ tests/Api/CustomersTest.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Api/Customers.php b/src/Api/Customers.php index 7384a84..39dc60f 100644 --- a/src/Api/Customers.php +++ b/src/Api/Customers.php @@ -87,4 +87,16 @@ public function show($id) { return $this->get('/customers/'.$id); } + + /** + * Remove customer by the provided ID. + * + * @param int $id + * @return array + */ + public function removeCustomer($id) + { + return $this->delete('/customers/'.$id); + } } +vv diff --git a/tests/Api/CustomersTest.php b/tests/Api/CustomersTest.php index 5bde618..e8e791e 100644 --- a/tests/Api/CustomersTest.php +++ b/tests/Api/CustomersTest.php @@ -88,4 +88,16 @@ public function test_can_customer_show() $this->assertTrue($api->ok()); } + + public function test_can_customer_delete() + { + Http::fake([ + '*rest/all/V1/customers/1' => Http::response([], 200), + ]); + + $api = MagentoFacade::api('customers')->remove(1); + + $this->assertTrue($api->ok()); + } } +vv From f4e99760c1b9cd79f3631893178cd66411bbcc00 Mon Sep 17 00:00:00 2001 From: mushood Date: Thu, 15 Sep 2022 18:23:09 +0200 Subject: [PATCH 2/4] fix customer delete test --- tests/Api/CustomersTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Api/CustomersTest.php b/tests/Api/CustomersTest.php index e8e791e..b8f2b69 100644 --- a/tests/Api/CustomersTest.php +++ b/tests/Api/CustomersTest.php @@ -95,7 +95,7 @@ public function test_can_customer_delete() '*rest/all/V1/customers/1' => Http::response([], 200), ]); - $api = MagentoFacade::api('customers')->remove(1); + $api = MagentoFacade::api('customers')->removeCustomer(1); $this->assertTrue($api->ok()); } From 6480beb0a375cc21bda2c777aae63c6a69fa27c2 Mon Sep 17 00:00:00 2001 From: mushood Date: Thu, 15 Sep 2022 18:21:18 +0200 Subject: [PATCH 3/4] delete customer by id --- src/Api/Customers.php | 12 ++++++++++++ tests/Api/CustomersTest.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Api/Customers.php b/src/Api/Customers.php index 7384a84..39dc60f 100644 --- a/src/Api/Customers.php +++ b/src/Api/Customers.php @@ -87,4 +87,16 @@ public function show($id) { return $this->get('/customers/'.$id); } + + /** + * Remove customer by the provided ID. + * + * @param int $id + * @return array + */ + public function removeCustomer($id) + { + return $this->delete('/customers/'.$id); + } } +vv diff --git a/tests/Api/CustomersTest.php b/tests/Api/CustomersTest.php index 5bde618..b8f2b69 100644 --- a/tests/Api/CustomersTest.php +++ b/tests/Api/CustomersTest.php @@ -88,4 +88,16 @@ public function test_can_customer_show() $this->assertTrue($api->ok()); } + + public function test_can_customer_delete() + { + Http::fake([ + '*rest/all/V1/customers/1' => Http::response([], 200), + ]); + + $api = MagentoFacade::api('customers')->removeCustomer(1); + + $this->assertTrue($api->ok()); + } } +vv From e3f4c6889920c4058163a9c0dbdee7e8847f6458 Mon Sep 17 00:00:00 2001 From: mushood Date: Thu, 15 Sep 2022 18:28:53 +0200 Subject: [PATCH 4/4] remove extra chars --- src/Api/Customers.php | 1 - tests/Api/CustomersTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Api/Customers.php b/src/Api/Customers.php index 39dc60f..e2d1591 100644 --- a/src/Api/Customers.php +++ b/src/Api/Customers.php @@ -99,4 +99,3 @@ public function removeCustomer($id) return $this->delete('/customers/'.$id); } } -vv diff --git a/tests/Api/CustomersTest.php b/tests/Api/CustomersTest.php index b8f2b69..59ab77d 100644 --- a/tests/Api/CustomersTest.php +++ b/tests/Api/CustomersTest.php @@ -100,4 +100,3 @@ public function test_can_customer_delete() $this->assertTrue($api->ok()); } } -vv