Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LowStockItemsTest.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
15  const SERVICE_VERSION = 'V1';
16  const RESOURCE_PATH = '/V1/stockItems/lowStock/';
17 
27  public function testGetLowStockItems($qty, $currentPage, $pageSize, $result)
28  {
29  $requestData = ['scopeId' => 1, 'qty' => $qty, 'pageSize' => $pageSize, 'currentPage' => $currentPage];
30  $serviceInfo = [
31  'rest' => [
32  'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
34  ],
35  'soap' => [
36  'service' => 'catalogInventoryStockRegistryV1',
37  'serviceVersion' => self::SERVICE_VERSION,
38  'operation' => 'catalogInventoryStockRegistryV1GetLowStockItems',
39  ],
40  ];
41  $output = $this->_webApiCall($serviceInfo, $requestData);
42  $this->assertArrayHasKey('items', $output);
43  }
44 
48  public function getLowStockItemsDataProvider()
49  {
50  return [
51  [
52  100,
53  1,
54  10,
55  [
56  'search_criteria' => ['current_page' => 1, 'page_size' => 10, 'qty' => 100],
57  'total_count' => 2,
58  'items' => [
59  [
60  'product_id' => 10,
61  'scope_id' => 1,
62  'stock_id' => 1,
63  'qty' => 100,
64  'stock_status' => null,
65  'stock_item' => null,
66  ],
67  [
68  'product_id' => 12,
69  'website_id' => 1,
70  'scope_id' => 1,
71  'qty' => 140,
72  'stock_status' => null,
73  'stock_item' => null
74  ],
75  ]
76  ],
77  ],
78  ];
79  }
80 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
testGetLowStockItems($qty, $currentPage, $pageSize, $result)