Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
IsProductSalableTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
12 
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 
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 }
testDeleteSourceItemConfiguration(string $sku, int $stockId, bool $expectedResult)
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)