|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © Magento, Inc. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
| 3 | + * Copyright 2017 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */
|
6 | 6 | namespace Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox;
|
7 | 7 |
|
8 | 8 | use Magento\Catalog\Api\Data\ProductInterface;
|
| 9 | +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; |
9 | 10 | use Magento\Catalog\Api\ProductRepositoryInterface;
|
10 | 11 | use Magento\Catalog\Model\Product;
|
11 | 12 | use Magento\Catalog\Pricing\Price\FinalPrice;
|
12 | 13 | use Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox;
|
| 14 | +use Magento\Framework\App\Area; |
13 | 15 | use Magento\Framework\Pricing\Render\Amount;
|
14 | 16 | use Magento\Framework\Pricing\Render\RendererPool;
|
| 17 | +use Magento\TestFramework\Fixture\AppArea; |
| 18 | +use Magento\TestFramework\Fixture\DataFixture; |
| 19 | +use Magento\TestFramework\Fixture\DbIsolation; |
15 | 20 | use Magento\TestFramework\Helper\Bootstrap;
|
16 | 21 |
|
17 | 22 | /**
|
@@ -101,6 +106,26 @@ public function testRenderingByDefault()
|
101 | 106 | );
|
102 | 107 | }
|
103 | 108 |
|
| 109 | + #[ |
| 110 | + DataFixture('Magento/ConfigurableProduct/_files/product_configurable.php'), |
| 111 | + AppArea(Area::AREA_FRONTEND), |
| 112 | + DbIsolation(false), |
| 113 | + ] |
| 114 | + public function testHasSpecialPrice(): void |
| 115 | + { |
| 116 | + $productAttributeRepository = Bootstrap::getObjectManager()->get(ProductAttributeRepositoryInterface::class); |
| 117 | + $specialPrice = $productAttributeRepository->get('special_price'); |
| 118 | + $specialPrice->setUsedInProductListing(false); |
| 119 | + $productAttributeRepository->save($specialPrice); |
| 120 | + |
| 121 | + try { |
| 122 | + self::assertTrue($this->finalPriceBox->hasSpecialPrice()); |
| 123 | + } finally { |
| 124 | + $specialPrice->setUsedInProductListing(true); |
| 125 | + $productAttributeRepository->save($specialPrice); |
| 126 | + } |
| 127 | + } |
| 128 | + |
104 | 129 | /**
|
105 | 130 | * Test when is_product_list flag is specified
|
106 | 131 | *
|
|
0 commit comments