Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit c05d5de

Browse files
authored
Merge pull request #91 from Mushood/feature/update_customer_by_id
2 parents f63910d + c687081 commit c05d5de

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Api/Customers.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ public function create($body)
3131
return $this->post('/customers', $body);
3232
}
3333

34+
/**
35+
* Update customer account.
36+
*
37+
* @param string $id
38+
* @param array $parameters
39+
* @return array
40+
*/
41+
public function update($id, $parameters = [])
42+
{
43+
return $this->put('/customers/'.$id, $parameters);
44+
}
45+
3446
/**
3547
* Send an email to the customer with a password reset link.
3648
*

tests/Api/CustomersTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ public function test_can_create_customer()
4545
$this->assertTrue($api->ok());
4646
}
4747

48+
public function test_can_update_customer()
49+
{
50+
Http::fake([
51+
'*rest/all/V1/customers/1' => Http::response([], 200),
52+
]);
53+
54+
$api = MagentoFacade::api('customers')->update(1, ['foo' => 'bar']);
55+
56+
$this->assertTrue($api->ok());
57+
}
58+
4859
public function test_can_request_password_reset_link()
4960
{
5061
Http::fake([

0 commit comments

Comments
 (0)