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

Commit 3552255

Browse files
authored
Merge pull request #43 from grayloon/bundle-product-options
Add Bundle Products Options Endpoint
2 parents 4c629ce + 97ea6da commit 3552255

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/Api/BundleProducts.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Grayloon\Magento\Api;
4+
5+
class BundleProducts extends AbstractApi
6+
{
7+
/**
8+
* Get all options for bundle product.
9+
*
10+
* @param string $sku
11+
* @return array
12+
*/
13+
public function options($sku)
14+
{
15+
return $this->get('/bundle-products/'.$sku.'/options/all');
16+
}
17+
}

tests/Api/BundleProductsTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Grayloon\Magento\Tests;
4+
5+
use Grayloon\Magento\Api\BundleProducts;
6+
use Grayloon\Magento\MagentoFacade;
7+
use Illuminate\Support\Facades\Http;
8+
9+
class BundleProductsTest extends TestCase
10+
{
11+
public function test_can_call_bundle_products()
12+
{
13+
$this->assertInstanceOf(BundleProducts::class, MagentoFacade::api('bundleProducts'));
14+
}
15+
16+
public function test_can_call_bundle_products_options()
17+
{
18+
Http::fake([
19+
'*rest/all/V1/bundle-products/foo/options/all' => Http::response([], 200),
20+
]);
21+
22+
$api = MagentoFacade::api('bundleProducts')->options('foo');
23+
24+
$this->assertTrue($api->ok());
25+
}
26+
}

0 commit comments

Comments
 (0)