Skip to content

Commit 082df33

Browse files
author
Michail Slabko
committed
Merge branch 'MAGETWO-47431' into pr-335
2 parents d458cac + a831bd1 commit 082df33

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

app/code/Magento/CatalogInventory/Helper/Stock.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ public function __construct(
6969
* Assign stock status information to product
7070
*
7171
* @param Product $product
72-
* @param int $stockStatus
72+
* @param int $status
7373
* @return void
7474
*/
75-
public function assignStatusToProduct(Product $product, $stockStatus = null)
75+
public function assignStatusToProduct(Product $product, $status = null)
7676
{
77-
if ($stockStatus === null) {
77+
if ($status === null) {
7878
$websiteId = $product->getStore()->getWebsiteId();
7979
$stockStatus = $this->stockRegistryProvider->getStockStatus($product->getId(), $websiteId);
8080
$status = $stockStatus->getStockStatus();

app/code/Magento/CatalogInventory/Observer/AddInventoryDataObserver.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ public function execute(EventObserver $observer)
3434
{
3535
$product = $observer->getEvent()->getProduct();
3636
if ($product instanceof \Magento\Catalog\Model\Product) {
37-
$this->stockHelper->assignStatusToProduct(
38-
$product,
39-
$product->getStockStatus()
40-
);
37+
$this->stockHelper->assignStatusToProduct($product);
4138
}
4239
}
4340
}

app/code/Magento/CatalogInventory/Test/Unit/Observer/AddInventoryDataObserverTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,17 @@ protected function setUp()
5757

5858
public function testAddInventoryData()
5959
{
60-
$stockStatus = true;
61-
6260
$product = $this->getMockBuilder('Magento\Catalog\Model\Product')
6361
->disableOriginalConstructor()
64-
->setMethods(['getStockStatus'])
6562
->getMock();
6663

67-
$product->expects($this->once())
68-
->method('getStockStatus')
69-
->will($this->returnValue($stockStatus));
70-
7164
$this->event->expects($this->once())
7265
->method('getProduct')
7366
->will($this->returnValue($product));
7467

7568
$this->stockHelper->expects($this->once())
7669
->method('assignStatusToProduct')
77-
->with($product, $stockStatus)
70+
->with($product)
7871
->will($this->returnSelf());
7972

8073
$this->observer->execute($this->eventObserver);

0 commit comments

Comments
 (0)