|
17 | 17 | use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface; |
18 | 18 | use Magento\Catalog\Model\Product\Option; |
19 | 19 | use Magento\Framework\Escaper; |
| 20 | +use Magento\Framework\Exception\LocalizedException; |
20 | 21 | use Magento\Framework\Pricing\Helper\Data; |
21 | 22 | use Magento\Framework\Serialize\Serializer\Json; |
22 | 23 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
@@ -178,6 +179,7 @@ public function testGetBundleOptionsEmptyBundleOptionsIds(): void |
178 | 179 |
|
179 | 180 | /** |
180 | 181 | * @return void |
| 182 | + * @throws LocalizedException |
181 | 183 | */ |
182 | 184 | public function testGetBundleOptionsEmptyBundleSelectionIds(): void |
183 | 185 | { |
@@ -222,10 +224,14 @@ public function testGetBundleOptionsEmptyBundleSelectionIds(): void |
222 | 224 | } |
223 | 225 |
|
224 | 226 | /** |
| 227 | + * @param $includingTax |
| 228 | + * @param $displayCartPriceBoth |
225 | 229 | * @return void |
| 230 | + * @throws LocalizedException |
| 231 | + * @dataProvider getTaxConfiguration |
226 | 232 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
227 | 233 | */ |
228 | | - public function testGetOptions(): void |
| 234 | + public function testGetOptions($includingTax, $displayCartPriceBoth): void |
229 | 235 | { |
230 | 236 | $optionIds = '{"0":"1"}'; |
231 | 237 | $selectionIds = '{"0":"2"}'; |
@@ -271,11 +277,11 @@ public function testGetOptions(): void |
271 | 277 | ->willReturn('name'); |
272 | 278 | $this->taxHelper->expects($this->any()) |
273 | 279 | ->method('getTaxPrice') |
274 | | - ->with($product, 15) |
| 280 | + ->with($product, 15, $includingTax) |
275 | 281 | ->willReturn(15.00); |
276 | 282 | $this->taxHelper->expects($this->any()) |
277 | 283 | ->method('displayCartPricesBoth') |
278 | | - ->willReturn(false); |
| 284 | + ->willReturn((bool)$displayCartPriceBoth); |
279 | 285 | $this->pricingHelper->expects($this->once())->method('currency')->with(15.00) |
280 | 286 | ->willReturn('<span class="price">$15.00</span>'); |
281 | 287 | $priceModel->expects($this->once())->method('getSelectionFinalTotalPrice')->willReturn(15.00); |
@@ -323,4 +329,19 @@ public function testGetOptions(): void |
323 | 329 | $this->helper->getOptions($this->item) |
324 | 330 | ); |
325 | 331 | } |
| 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 | + } |
326 | 347 | } |
0 commit comments