Skip to content

Commit 510bdd5

Browse files
committed
ACP2E-1456: fix unit test errors
1 parent 5ebf71a commit 510bdd5

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ private function getOptionPriceHtml(ItemInterface $item, ProductInterface $bundl
214214
. $this->pricingHelper->currency(
215215
$selectionFinalPrice
216216
)
217-
. ' '
218-
. ($displayCartPricesBoth ? __('Excl. tax:') . ' '
217+
. ($displayCartPricesBoth ? ' ' . __('Excl. tax:') . ' '
219218
. $this->pricingHelper->currency(
220219
$selectionFinalPriceExclTax
221220
) : '');

app/code/Magento/Bundle/Test/Unit/Helper/Catalog/Product/ConfigurationTest.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface;
1818
use Magento\Catalog\Model\Product\Option;
1919
use Magento\Framework\Escaper;
20+
use Magento\Framework\Exception\LocalizedException;
2021
use Magento\Framework\Pricing\Helper\Data;
2122
use Magento\Framework\Serialize\Serializer\Json;
2223
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
@@ -178,6 +179,7 @@ public function testGetBundleOptionsEmptyBundleOptionsIds(): void
178179

179180
/**
180181
* @return void
182+
* @throws LocalizedException
181183
*/
182184
public function testGetBundleOptionsEmptyBundleSelectionIds(): void
183185
{
@@ -222,10 +224,14 @@ public function testGetBundleOptionsEmptyBundleSelectionIds(): void
222224
}
223225

224226
/**
227+
* @param $includingTax
228+
* @param $displayCartPriceBoth
225229
* @return void
230+
* @throws LocalizedException
231+
* @dataProvider getTaxConfiguration
226232
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
227233
*/
228-
public function testGetOptions(): void
234+
public function testGetOptions($includingTax, $displayCartPriceBoth): void
229235
{
230236
$optionIds = '{"0":"1"}';
231237
$selectionIds = '{"0":"2"}';
@@ -271,11 +277,11 @@ public function testGetOptions(): void
271277
->willReturn('name');
272278
$this->taxHelper->expects($this->any())
273279
->method('getTaxPrice')
274-
->with($product, 15)
280+
->with($product, 15, $includingTax)
275281
->willReturn(15.00);
276282
$this->taxHelper->expects($this->any())
277283
->method('displayCartPricesBoth')
278-
->willReturn(false);
284+
->willReturn((bool)$displayCartPriceBoth);
279285
$this->pricingHelper->expects($this->once())->method('currency')->with(15.00)
280286
->willReturn('<span class="price">$15.00</span>');
281287
$priceModel->expects($this->once())->method('getSelectionFinalTotalPrice')->willReturn(15.00);
@@ -323,4 +329,19 @@ public function testGetOptions(): void
323329
$this->helper->getOptions($this->item)
324330
);
325331
}
332+
333+
/**
334+
* Data provider for testGetOptions
335+
*
336+
* @return array
337+
*/
338+
public function getTaxConfiguration(): array
339+
{
340+
return [
341+
[1, 0],
342+
[0, 0],
343+
[1, 1],
344+
[0, 1]
345+
];
346+
}
326347
}

0 commit comments

Comments
 (0)