From b92579e515204794a7bcb6197dd41804bfe36552 Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 21 Jan 2019 16:50:46 +0300 Subject: [PATCH] v2.2.9 --- tests/phpunit/RetailcrmInventoriesTest.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/RetailcrmInventoriesTest.php b/tests/phpunit/RetailcrmInventoriesTest.php index 352b408..8e720ee 100644 --- a/tests/phpunit/RetailcrmInventoriesTest.php +++ b/tests/phpunit/RetailcrmInventoriesTest.php @@ -60,9 +60,18 @@ class RetailcrmInventoriesTest extends RetailcrmTestCase $product1Id = explode('#', $this->product1['id']); $product2Id = explode('#', $this->product2['id']); - - $prod1Quantity = StockAvailable::getQuantityAvailableByProduct($product1Id[0], $product1Id[1] ); - $prod2Quantity = StockAvailable::getQuantityAvailableByProduct($product2Id[0], $product2Id[1] ); + + if (isset($product1Id[1])){ + $prod1Quantity = StockAvailable::getQuantityAvailableByProduct($product1Id[0], $product1Id[1]); + } else { + $prod1Quantity = StockAvailable::getQuantityAvailableByProduct($product1Id[0], 0); + } + + if (isset($product2Id[1])){ + $prod2Quantity = StockAvailable::getQuantityAvailableByProduct($product2Id[0], $product2Id[1]); + } else { + $prod2Quantity = StockAvailable::getQuantityAvailableByProduct($product2Id[0], 0); + } $this->assertEquals(self::PRODUCT1_QUANTITY, $prod1Quantity); $this->assertEquals(self::PRODUCT2_QUANTITY, $prod2Quantity);