Skip to content

Commit 978c11a

Browse files
committed
Unit Test Code coverage with test failure fixes
1 parent bf0d1e9 commit 978c11a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public function getValue()
6161
$price = $product->getPriceInfo()->getPrice(self::PRICE_CODE)->getValue();
6262

6363
if ($product->getProductOptionsCollection()) {
64-
foreach ($product->getProductOptionsCollection() as $configurationOptionsVal) {
64+
foreach ($product->getProductOptionsCollection() as $k => $configurationOptionsVal) {
6565
$configurableOptionsData = $configurationOptionsVal->getValues();
66-
foreach($configurableOptionsData as $configurableOptionData) {
66+
foreach ($configurableOptionsData as $configurableOptionData) {
6767
$price += $configurableOptionData->getPrice();
6868
}
6969
}

app/code/Magento/Wishlist/Test/Unit/Pricing/ConfiguredPrice/ConfigurableProductTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function testGetValue()
103103
$productMock = $this->getMockBuilder(Product::class)
104104
->disableOriginalConstructor()
105105
->getMock();
106+
106107
$productMock->expects($this->once())
107108
->method('getPriceInfo')
108109
->willReturn($this->priceInfoMock);
@@ -153,7 +154,8 @@ public function testGetValueWithNoCustomOption()
153154
$this->assertEquals(100, $this->model->getValue());
154155
}
155156

156-
public function testGetValueWithCustomOption() {
157+
public function testGetValueWithCustomOption()
158+
{
157159
$priceValue = 10;
158160
$customOptionPrice = 5;
159161

@@ -194,13 +196,13 @@ public function testGetValueWithCustomOption() {
194196
$productOptionMock = $this->getMockBuilder('Magento\Catalog\Model\ResourceModel\Product\Option\Collection')
195197
->disableOriginalConstructor()
196198
->addMethods(['getValues'])
197-
->onlyMethods(['getIterator','getData'])
199+
->onlyMethods(['getIterator'])
198200
->getMock();
199201

200-
$productValMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Option\Value')
202+
$productValMock = $this->getMockBuilder('Magento\Catalog\Model\ResourceModel\Product\Option\Value\Collection')
201203
->disableOriginalConstructor()
202-
->addMethods(['getIterator'])
203-
->onlyMethods(['getPrice'])
204+
->addMethods(['getPrice'])
205+
->onlyMethods(['getIterator'])
204206
->getMock();
205207

206208
$productMock->expects($this->atLeastOnce())

0 commit comments

Comments
 (0)