Skip to content

Commit

Permalink
Merge pull request magento#764 from magento-engcom/msi743
Browse files Browse the repository at this point in the history
"Could not receive Stock Item data" Line Appear Instead of Admin Product Grid.
  • Loading branch information
maghamed authored Mar 28, 2018
2 parents 50bfa8b + 40a2beb commit e665fca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/code/Magento/InventoryIndexer/Model/GetStockItemData.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public function execute(string $sku, int $stockId)
->where(IndexStructure::SKU . ' = ?', $sku);

try {
return $connection->fetchRow($select) ?: null;
if ($connection->isTableExists($stockItemTableName)) {
return $connection->fetchRow($select) ?: null;
}

return null;
} catch (\Exception $e) {
throw new LocalizedException(__(
'Could not receive Stock Item data'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ public function testGetStockItemData(string $sku, int $stockId, $expectedData)
self::assertEquals($expectedData, $stockItemData);
}

/**
* @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedExceptionMessage Could not receive Stock Item data
*/
public function testGetStockItemDataException()
public function testGetStockItemDataReturnNullWhenTableDoesNotExist()
{
$this->getStockItemData->execute('SKU-1', 10);
$stockItemData = $this->getStockItemData->execute('SKU-1', 10);
self::assertNull($stockItemData);
}

/**
Expand Down

0 comments on commit e665fca

Please sign in to comment.