From 6181a6fcc51db1fd061fc5f5a1a0f0599c0ce17e Mon Sep 17 00:00:00 2001 From: Jin Date: Sat, 1 Apr 2023 15:49:50 +0700 Subject: [PATCH] add: create brand --- src/Resources/Product.php | 9 +++++++++ tests/Resources/ProductTest.php | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/Resources/Product.php b/src/Resources/Product.php index 3869601..c8eca09 100644 --- a/src/Resources/Product.php +++ b/src/Resources/Product.php @@ -159,6 +159,15 @@ public function getBrands(array $params) ]); } + public function createBrand(string $brand_name) + { + return $this->call('POST', 'brand', [ + RequestOptions::JSON => [ + 'brand_name' => $brand_name + ] + ]); + } + public function getAttributes($category_id) { return $this->call('GET', 'attributes', [ diff --git a/tests/Resources/ProductTest.php b/tests/Resources/ProductTest.php index cb5f773..b703a63 100644 --- a/tests/Resources/ProductTest.php +++ b/tests/Resources/ProductTest.php @@ -68,6 +68,12 @@ public function testGetBrands() $this->assertPreviousRequest('GET', 'products/brands'); } + public function testCreateBrand() + { + $this->caller->createBrand('sample brand'); + $this->assertPreviousRequest('POST', 'products/brand'); + } + public function testDeleteProduct() { $this->caller->deleteProduct([]);