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

Commit ebc07d7

Browse files
authored
Merge pull request #54 from grayloon/store-websites
Store websites Endpoint
2 parents eb30ad0 + 6c144f9 commit ebc07d7

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/Api/Stores.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Grayloon\Magento\Api;
4+
5+
class Stores extends AbstractApi
6+
{
7+
/**
8+
* Retrieve list of all websites.
9+
*
10+
* @return array
11+
*/
12+
public function websites()
13+
{
14+
return $this->get('/store/websites');
15+
}
16+
}

tests/Api/StoresTest.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\Stores;
6+
use Grayloon\Magento\MagentoFacade;
7+
use Illuminate\Support\Facades\Http;
8+
9+
class StoresTest extends TestCase
10+
{
11+
public function test_can_instantiate_stores()
12+
{
13+
$this->assertInstanceOf(Stores::class, MagentoFacade::api('stores'));
14+
}
15+
16+
public function test_can_call_stores_websites()
17+
{
18+
Http::fake([
19+
'*rest/all/V1/store/websites*' => Http::response([], 200),
20+
]);
21+
22+
$api = MagentoFacade::api('stores')->websites();
23+
24+
$this->assertTrue($api->ok());
25+
}
26+
}

0 commit comments

Comments
 (0)