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