Skip to content

Commit c74965d

Browse files
committed
MAGETWO-45311: Remove dependency on Website for Cataloginventory
- Some fixes for web-api
1 parent b74e1c8 commit c74965d

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/LowStockItemsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class LowStockItemsTest extends WebapiAbstract
2626
*/
2727
public function testGetLowStockItems($qty, $currentPage, $pageSize, $result)
2828
{
29-
$requestData = ['websiteId' => 1, 'qty' => $qty, 'pageSize' => $pageSize, 'currentPage' => $currentPage];
29+
$requestData = ['qty' => $qty, 'pageSize' => $pageSize, 'currentPage' => $currentPage];
3030
$serviceInfo = [
3131
'rest' => [
3232
'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
@@ -58,15 +58,13 @@ public function getLowStockItemsDataProvider()
5858
'items' => [
5959
[
6060
'product_id' => 10,
61-
'website_id' => 1,
6261
'stock_id' => 1,
6362
'qty' => 100,
6463
'stock_status' => null,
6564
'stock_item' => null,
6665
],
6766
[
6867
'product_id' => 12,
69-
'website_id' => 1,
7068
'stock_id' => 1,
7169
'qty' => 140,
7270
'stock_status' => null,

dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/ProductRepositoryInterfaceTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract
2121
const KEY_QTY = StockStatusInterface::QTY;
2222
const KEY_ITEM_ID = 'item_id';
2323
const KEY_PRODUCT_ID = StockStatusInterface::PRODUCT_ID;
24-
const KEY_WEBSITE_ID = StockStatusInterface::WEBSITE_ID;
2524
const KEY_CUSTOM_ATTRIBUTES = 'custom_attributes';
2625
const KEY_ATTRIBUTE_CODE = \Magento\Eav\Api\Data\AttributeInterface::ATTRIBUTE_CODE;
2726
const CODE_QUANTITY_AND_STOCK_STATUS = 'quantity_and_stock_status';
@@ -38,7 +37,6 @@ public function testCatalogInventory()
3837
$productData = $this->getSimpleProductData($qty);
3938
$stockItemData = $this->getStockItemData($qty);
4039
$this->assertArrayNotHasKey(self::KEY_ITEM_ID, $stockItemData);
41-
$this->assertArrayNotHasKey(self::KEY_WEBSITE_ID, $stockItemData);
4240
$this->assertArrayNotHasKey(self::KEY_PRODUCT_ID, $stockItemData);
4341
$productData[self::KEY_EXTENSION_ATTRIBUTES] = $stockItemData;
4442

@@ -51,7 +49,6 @@ public function testCatalogInventory()
5149
$this->assertEquals($qty, $returnedQty, 'CREATE: Expected qty to be same: ' . $qty .', '. $returnedQty);
5250
$this->assertArrayHasKey(self::KEY_ITEM_ID, $stockItemData);
5351
$this->assertArrayHasKey(self::KEY_PRODUCT_ID, $stockItemData);
54-
$this->assertArrayHasKey(self::KEY_WEBSITE_ID, $stockItemData);
5552

5653
// officially get the product
5754
$response = $this->getProduct($productData[ProductInterface::SKU]);
@@ -100,7 +97,6 @@ public function testCatalogInventoryWithBogusData()
10097
$productData = $this->getSimpleProductData($qty);
10198
$stockItemData = $this->getStockItemData($qty);
10299
$this->assertArrayNotHasKey(self::KEY_ITEM_ID, $stockItemData);
103-
$this->assertArrayNotHasKey(self::KEY_WEBSITE_ID, $stockItemData);
104100
$this->assertArrayNotHasKey(self::KEY_PRODUCT_ID, $stockItemData);
105101
$productData[self::KEY_EXTENSION_ATTRIBUTES] = $stockItemData;
106102

@@ -113,7 +109,6 @@ public function testCatalogInventoryWithBogusData()
113109
$this->assertEquals($qty, $returnedQty, 'POST 1: Expected qty to be same: ' . $qty .', '. $returnedQty);
114110
$this->assertArrayHasKey(self::KEY_ITEM_ID, $stockItemData);
115111
$this->assertArrayHasKey(self::KEY_PRODUCT_ID, $stockItemData);
116-
$this->assertArrayHasKey(self::KEY_WEBSITE_ID, $stockItemData);
117112

118113
// re-save the catalog inventory:
119114
// -- update quantity (which should be honored)
@@ -126,9 +121,7 @@ public function testCatalogInventoryWithBogusData()
126121
$bogusProductId = $this->getDifferent($originalProductId);
127122
$response[self::KEY_EXTENSION_ATTRIBUTES][self::KEY_STOCK_ITEM][self::KEY_PRODUCT_ID] = $bogusProductId;
128123

129-
$originalWebsiteId = $stockItemData[self::KEY_WEBSITE_ID];
130124
$bogusWebsiteId = $this->getDifferent($originalWebsiteId);
131-
$response[self::KEY_EXTENSION_ATTRIBUTES][self::KEY_STOCK_ITEM][self::KEY_WEBSITE_ID] = $bogusWebsiteId;
132125

133126
$response = $this->saveProduct($response);
134127

@@ -139,7 +132,6 @@ public function testCatalogInventoryWithBogusData()
139132
$returnedProductId = $stockItemData[self::KEY_PRODUCT_ID];
140133
$this->assertEquals($originalProductId, $returnedProductId);
141134

142-
$returnedWebsiteId = $stockItemData[self::KEY_WEBSITE_ID];
143135
$this->assertEquals($originalWebsiteId, $returnedWebsiteId);
144136

145137
// delete the product; expect that all goes well
@@ -165,7 +157,6 @@ public function testSimpleProductCreationWithoutSpecifyingCatalogInventory()
165157
$stockItemData = $response[self::KEY_EXTENSION_ATTRIBUTES][self::KEY_STOCK_ITEM];
166158
$this->assertArrayHasKey(self::KEY_ITEM_ID, $stockItemData);
167159
$this->assertArrayHasKey(self::KEY_PRODUCT_ID, $stockItemData);
168-
$this->assertArrayHasKey(self::KEY_WEBSITE_ID, $stockItemData);
169160

170161
// delete the product; expect that all goes well
171162
$response = $this->deleteProduct($productData[ProductInterface::SKU]);

dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ public function saveStockItemBySkuWithWrongInputDataProvider()
136136
'item_id' => 222,
137137
'product_id' => 222,
138138
'stock_id' => 1,
139-
'website_id' => 1,
140139
'qty' => '111.0000',
141140
'min_qty' => '0.0000',
142141
'use_config_min_qty' => 1,
@@ -186,13 +185,11 @@ public function saveStockItemBySkuWithWrongInputDataProvider()
186185
'use_config_enable_qty_inc' => '1',
187186
'enable_qty_increments' => '0',
188187
'is_decimal_divided' => '0',
189-
'website_id' => '1',
190188
'type_id' => 'simple',
191189
],
192190
[
193191
'item_id' => 1,
194192
'product_id' => 10,
195-
'website_id' => 1,
196193
'stock_id' => 1,
197194
'qty' => 100,
198195
'is_in_stock' => 1,

0 commit comments

Comments
 (0)