Skip to content

Commit

Permalink
add: create brand
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin committed Apr 1, 2023
1 parent 0f14195 commit 6181a6f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Resources/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down
6 changes: 6 additions & 0 deletions tests/Resources/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down

0 comments on commit 6181a6f

Please sign in to comment.