Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
GetDefaultStockToSourceLinkTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
16 
18 {
22  private $defaultSourceProvider;
23 
27  private $defaultStockProvider;
28 
29  protected function setUp()
30  {
31  parent::setUp();
32  $this->defaultSourceProvider = Bootstrap::getObjectManager()->get(DefaultSourceProviderInterface::class);
33  $this->defaultStockProvider = Bootstrap::getObjectManager()->get(DefaultStockProviderInterface::class);
34  }
35 
40  {
41  $defaultStockId = $this->defaultStockProvider->getId();
42  $defaultSourceCode = $this->defaultSourceProvider->getCode();
43  $serviceInfo = [
44  'rest' => [
45  'resourcePath' => '/V1/inventory/get-sources-assigned-to-stock-ordered-by-priority/' . $defaultStockId,
46  'httpMethod' => Request::HTTP_METHOD_GET,
47  ],
48  'soap' => [
49  'service' => 'inventoryApiGetSourcesAssignedToStockOrderedByPriorityV1',
50  'operation' => 'inventoryApiGetSourcesAssignedToStockOrderedByPriorityV1Execute',
51  ],
52  ];
53  if (self::ADAPTER_REST === TESTS_WEB_API_ADAPTER) {
54  $source = $this->_webApiCall($serviceInfo);
55  } else {
56  $source = $this->_webApiCall($serviceInfo, ['stockId' => $defaultStockId]);
57  }
58  $this->assertEquals([$defaultSourceCode], array_column($source, SourceInterface::SOURCE_CODE));
59  }
60 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
$source
Definition: source.php:23