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

Commit 66cf122

Browse files
authored
Merge pull request #58 from jeroen-hso/master
Add product edit endpoint
2 parents da867f0 + 8e8e224 commit 66cf122

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Api/Products.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,16 @@ public function show($sku)
3131
{
3232
return $this->get('/products/'.$sku);
3333
}
34+
35+
/**
36+
* Edit product.
37+
*
38+
* @param string $sku
39+
* @param array $body
40+
* @return array
41+
*/
42+
public function edit($sku, $body = [])
43+
{
44+
return $this->put('/products/'.$sku, $body);
45+
}
3446
}

tests/Api/ProductTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,15 @@ public function test_can_call_magento_api_products_show()
3030

3131
$this->assertTrue($api->ok());
3232
}
33+
34+
public function test_can_edit_product()
35+
{
36+
Http::fake([
37+
'*rest/all/V1/products/foo' => Http::response([], 200),
38+
]);
39+
40+
$api = MagentoFacade::api('products')->edit('foo', []);
41+
42+
$this->assertTrue($api->ok());
43+
}
3344
}

0 commit comments

Comments
 (0)