Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GetDefaultStockTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
15 
17 {
21  private $defaultStockProvider;
22 
23  protected function setUp()
24  {
25  parent::setUp();
26  $this->defaultStockProvider = Bootstrap::getObjectManager()->get(DefaultStockProviderInterface::class);
27  }
28 
32  public function testGetDefaultSource()
33  {
34  $defaultStockId = $this->defaultStockProvider->getId();
35  $serviceInfo = [
36  'rest' => [
37  'resourcePath' => '/V1/inventory/stocks/' . $defaultStockId,
38  'httpMethod' => Request::HTTP_METHOD_GET,
39  ],
40  'soap' => [
41  'service' => 'inventoryApiStockRepositoryV1',
42  'operation' => 'inventoryApiStockRepositoryV1Get',
43  ],
44  ];
45  if (self::ADAPTER_REST === TESTS_WEB_API_ADAPTER) {
46  $stock = $this->_webApiCall($serviceInfo);
47  } else {
48  $stock = $this->_webApiCall($serviceInfo, ['stockId' => $defaultStockId]);
49  }
50  $this->assertEquals($defaultStockId, $stock[StockInterface::STOCK_ID]);
51  }
52 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
$stock