Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-inventory-catalog
Test
Api
GetDefaultStockTest.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryCatalog\Test\Api
;
9
10
use
Magento\InventoryApi\Api\Data\StockInterface
;
11
use
Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface
;
12
use
Magento\TestFramework\Helper\Bootstrap
;
13
use
Magento\TestFramework\TestCase\WebapiAbstract
;
14
use
Magento\Framework\Webapi\Rest\Request
;
15
16
class
GetDefaultStockTest
extends
WebapiAbstract
17
{
21
private
$defaultStockProvider;
22
23
protected
function
setUp
()
24
{
25
parent::setUp();
26
$this->defaultStockProvider =
Bootstrap::getObjectManager
()->get(DefaultStockProviderInterface::class);
27
}
28
32
public
function
testGetDefaultSource
()
33
{
34
$defaultStockId = $this->defaultStockProvider->getId();
35
$serviceInfo = [
36
'rest'
=> [
37
'resourcePath'
=>
'/V1/inventory/stocks/'
. $defaultStockId,
38
'httpMethod'
=>
Request::HTTP_METHOD_GET
,
39
],
40
'soap'
=> [
41
'service'
=>
'inventoryApiStockRepositoryV1'
,
42
'operation'
=>
'inventoryApiStockRepositoryV1Get'
,
43
],
44
];
45
if
(self::ADAPTER_REST === TESTS_WEB_API_ADAPTER) {
46
$stock
= $this->
_webApiCall
($serviceInfo);
47
}
else
{
48
$stock
= $this->
_webApiCall
($serviceInfo, [
'stockId'
=> $defaultStockId]);
49
}
50
$this->assertEquals($defaultStockId,
$stock
[
StockInterface::STOCK_ID
]);
51
}
52
}
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
Magento\TestFramework\TestCase\WebapiAbstract\_webApiCall
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
Definition:
WebapiAbstract.php:165
Magento\InventoryApi\Api\Data\StockInterface\STOCK_ID
const STOCK_ID
Definition:
StockInterface.php:22
Magento\InventoryApi\Api\Data\StockInterface
Definition:
StockInterface.php:17
Magento\InventoryCatalog\Test\Api\GetDefaultStockTest\setUp
setUp()
Definition:
GetDefaultStockTest.php:23
Magento\InventoryCatalog\Test\Api
Definition:
GetDefaultSourceTest.php:8
Magento\Framework\Webapi\Rest\Request\HTTP_METHOD_GET
const HTTP_METHOD_GET
Definition:
Request.php:19
Magento\InventoryCatalog\Test\Api\GetDefaultStockTest\testGetDefaultSource
testGetDefaultSource()
Definition:
GetDefaultStockTest.php:32
Magento\Framework\Webapi\Rest\Request
Magento\TestFramework\TestCase\WebapiAbstract
Definition:
WebapiAbstract.php:19
Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface
Definition:
DefaultStockProviderInterface.php:15
$stock
$stock
Definition:
product_alert.php:22
Magento\InventoryCatalog\Test\Api\GetDefaultStockTest
Definition:
GetDefaultStockTest.php:16
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125