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-sales-api
Test
Api
IsProductSalableTest.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventorySalesApi\Test\Api
;
9
10
use
Magento\TestFramework\TestCase\WebapiAbstract
;
11
use
Magento\Framework\Webapi\Rest\Request
;
12
13
class
IsProductSalableTest
extends
WebapiAbstract
14
{
15
const
API_PATH
=
'/V1/inventory/is-product-salable'
;
16
const
SERVICE_NAME
=
'inventorySalesApiIsProductSalableV1'
;
17
21
public
function
executeDataProvider
(): array
22
{
23
return
[
24
[
'SKU-1'
, 10,
true
],
25
[
'SKU-1'
, 20,
false
],
26
[
'SKU-1'
, 30,
true
],
27
];
28
}
29
46
public
function
testDeleteSourceItemConfiguration
(
47
string
$sku,
48
int
$stockId,
49
bool
$expectedResult
50
) {
51
$serviceInfo = [
52
'rest'
=> [
53
'resourcePath'
=> self::API_PATH .
'/'
. $sku .
'/'
. $stockId,
54
'httpMethod'
=>
Request::HTTP_METHOD_GET
,
55
],
56
'soap'
=> [
57
'service'
=>
self::SERVICE_NAME
,
58
'operation'
=> self::SERVICE_NAME .
'Execute'
,
59
],
60
];
61
62
$res = (TESTS_WEB_API_ADAPTER ===
self::ADAPTER_REST
)
63
? $this->
_webApiCall
($serviceInfo)
64
: $this->
_webApiCall
($serviceInfo, [
65
'sku'
=> $sku,
66
'stockId'
=> $stockId
67
]);
68
69
self::assertEquals($expectedResult, $res);
70
}
71
}
Magento\InventorySalesApi\Test\Api\IsProductSalableTest\testDeleteSourceItemConfiguration
testDeleteSourceItemConfiguration(string $sku, int $stockId, bool $expectedResult)
Definition:
IsProductSalableTest.php:46
Magento\TestFramework\TestCase\WebapiAbstract\_webApiCall
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
Definition:
WebapiAbstract.php:165
Magento\InventorySalesApi\Test\Api\IsProductSalableTest\SERVICE_NAME
const SERVICE_NAME
Definition:
IsProductSalableTest.php:16
Magento\InventorySalesApi\Test\Api
Definition:
IsProductSalableForRequestedQtyTest.php:8
Magento\Framework\Webapi\Rest\Request\HTTP_METHOD_GET
const HTTP_METHOD_GET
Definition:
Request.php:19
Magento\InventorySalesApi\Test\Api\IsProductSalableTest\executeDataProvider
executeDataProvider()
Definition:
IsProductSalableTest.php:21
Magento\InventorySalesApi\Test\Api\IsProductSalableTest\API_PATH
const API_PATH
Definition:
IsProductSalableTest.php:15
Magento\InventorySalesApi\Test\Api\IsProductSalableTest
Definition:
IsProductSalableTest.php:13
Magento\Framework\Webapi\Rest\Request
Magento\TestFramework\TestCase\WebapiAbstract
Definition:
WebapiAbstract.php:19
Magento\TestFramework\TestCase\WebapiAbstract\ADAPTER_REST
const ADAPTER_REST
Definition:
WebapiAbstract.php:34