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

Commit 28575b3

Browse files
committed
add tests
1 parent a7118a3 commit 28575b3

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

tests/Api/SourcesTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Grayloon\Magento\Tests;
4+
5+
use Grayloon\Magento\Api\Sources;
6+
use Grayloon\Magento\MagentoFacade;
7+
use Illuminate\Support\Facades\Http;
8+
9+
class SourcesTest extends TestCase
10+
{
11+
public function test_can_instantiate_sources()
12+
{
13+
$this->assertInstanceOf(Sources::class, MagentoFacade::api('sources'));
14+
}
15+
16+
public function test_can_call_sources_all()
17+
{
18+
Http::fake([
19+
'*rest/all/V1/inventory/sources*' => Http::response([], 200),
20+
]);
21+
22+
$api = MagentoFacade::api('sources')->all();
23+
24+
$this->assertTrue($api->ok());
25+
}
26+
27+
public function test_can_call_sources_by_source_name()
28+
{
29+
Http::fake([
30+
'*rest/all/V1/inventory/sources/default*' => Http::response([], 200),
31+
]);
32+
33+
$api = MagentoFacade::api('sources')->bySourceName();
34+
35+
$this->assertTrue($api->ok());
36+
}
37+
}

tests/Api/StocksTest.php

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

0 commit comments

Comments
 (0)