Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetStockSourceLinksTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
16 
18 {
22  const RESOURCE_PATH = '/V1/inventory/stock-source-links';
23  const SERVICE_NAME = 'inventoryApiGetStockSourceLinksV1';
31  public function testGetList()
32  {
33  $requestData = [
34  'searchCriteria' => [
36  [
37  'filters' => [
38  [
40  'value' => 10,
41  'condition_type' => 'eq',
42  ],
43  ],
44  ],
45  ],
47  [
49  'direction' => SortOrder::SORT_DESC,
50  ],
51  ],
54  ],
55  ];
56  $expectedTotalCount = 4;
57  $expectedItemsData = [
58  [
62  ],
63  [
67  ],
68  ];
69 
70  $serviceInfo = [
71  'rest' => [
72  'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
73  'httpMethod' => Request::HTTP_METHOD_GET,
74  ],
75  'soap' => [
76  'service' => self::SERVICE_NAME,
77  'operation' => self::SERVICE_NAME . 'Execute',
78  ],
79  ];
80  $response = (TESTS_WEB_API_ADAPTER === self::ADAPTER_REST)
81  ? $this->_webApiCall($serviceInfo)
82  : $this->_webApiCall($serviceInfo, $requestData);
83 
84  AssertArrayContains::assert($requestData['searchCriteria'], $response['search_criteria']);
85  self::assertEquals($expectedTotalCount, $response['total_count']);
86  AssertArrayContains::assert($expectedItemsData, $response['items']);
87  }
88 }
$response
Definition: 404.php:11
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
static assert(array $expected, array $actual)