|
6 | 6 |
|
7 | 7 | namespace Magento\Catalog\Pricing\Render;
|
8 | 8 |
|
9 |
| -use Magento\TestFramework\Helper\Bootstrap; |
10 |
| -use Magento\Framework\ObjectManagerInterface; |
11 |
| -use Magento\Catalog\Pricing\Price\FinalPrice; |
12 |
| -use Magento\Framework\Pricing\Render\RendererPool; |
| 9 | +use Magento\Catalog\Api\Data\ProductInterface; |
13 | 10 | use Magento\Catalog\Api\ProductRepositoryInterface;
|
14 |
| -use Magento\Framework\Pricing\Render\Amount; |
15 |
| -use Magento\Framework\App\State; |
| 11 | +use Magento\Catalog\Pricing\Price\FinalPrice; |
| 12 | +use Magento\Catalog\Test\Fixture\Category as CategoryFixture; |
| 13 | +use Magento\Catalog\Test\Fixture\Product as ProductFixture; |
| 14 | +use Magento\Customer\Model\Group; |
16 | 15 | use Magento\Framework\App\Area;
|
| 16 | +use Magento\Framework\App\State; |
| 17 | +use Magento\Framework\ObjectManagerInterface; |
| 18 | +use Magento\Framework\Pricing\Render\Amount; |
| 19 | +use Magento\Framework\Pricing\Render\RendererPool; |
17 | 20 | use Magento\Framework\View\TemplateEngine\Php;
|
18 | 21 | use Magento\Framework\View\TemplateEnginePool;
|
19 |
| -use Magento\Catalog\Api\Data\ProductInterface; |
| 22 | +use Magento\Tax\Model\Config as TaxConfig; |
| 23 | +use Magento\Tax\Test\Fixture\CustomerTaxClass as CustomerTaxClassFixture; |
| 24 | +use Magento\Tax\Test\Fixture\ProductTaxClass as ProductTaxClassFixture; |
| 25 | +use Magento\Tax\Test\Fixture\TaxRate as TaxRateFixture; |
| 26 | +use Magento\Tax\Test\Fixture\TaxRule as TaxRuleFixture; |
| 27 | +use Magento\TestFramework\Fixture\AppIsolation; |
| 28 | +use Magento\TestFramework\Fixture\Config; |
| 29 | +use Magento\TestFramework\Fixture\DataFixture; |
| 30 | +use Magento\TestFramework\Fixture\DbIsolation; |
| 31 | +use Magento\TestFramework\Helper\Bootstrap; |
20 | 32 |
|
21 | 33 | /**
|
22 | 34 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
@@ -97,8 +109,7 @@ protected function setUp(): void
|
97 | 109 |
|
98 | 110 | $this->rendererPool->setData(
|
99 | 111 | [
|
100 |
| - 'default' => |
101 |
| - [ |
| 112 | + 'default' => [ |
102 | 113 | 'default_amount_render_class' => Amount::class,
|
103 | 114 | 'default_amount_render_template' => 'Magento_Catalog::product/price/amount/default.phtml'
|
104 | 115 | ]
|
@@ -147,4 +158,48 @@ public function testProductSetDifferentStorePricesWithoutTierPriceShouldNotShowA
|
147 | 158 | {
|
148 | 159 | $this->assertEmpty($this->finalPriceBox->renderAmountMinimal());
|
149 | 160 | }
|
| 161 | + |
| 162 | + #[ |
| 163 | + AppIsolation(true), |
| 164 | + DbIsolation(false), |
| 165 | + Config(TaxConfig::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, 0), |
| 166 | + Config(TaxConfig::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, 3), |
| 167 | + DataFixture(CategoryFixture::class, as: 'category'), |
| 168 | + DataFixture( |
| 169 | + ProductFixture::class, |
| 170 | + [ |
| 171 | + 'sku' => 'tier_prices', |
| 172 | + 'category_ids' => ['1', '$category.id$'], |
| 173 | + 'tier_prices' => [ |
| 174 | + [ |
| 175 | + 'customer_group_id' => Group::NOT_LOGGED_IN_ID, |
| 176 | + 'qty' => 2, |
| 177 | + 'value' => 5 |
| 178 | + ] |
| 179 | + ] |
| 180 | + ] |
| 181 | + ), |
| 182 | + DataFixture(CustomerTaxClassFixture::class, as: 'customerTax'), |
| 183 | + DataFixture(ProductTaxClassFixture::class, as: 'productTax'), |
| 184 | + DataFixture( |
| 185 | + TaxRateFixture::class, |
| 186 | + [], |
| 187 | + 'rate' |
| 188 | + ), |
| 189 | + DataFixture( |
| 190 | + TaxRuleFixture::class, |
| 191 | + [ |
| 192 | + 'customer_tax_class_ids' => ['$customerTax.id$'], |
| 193 | + 'product_tax_class_ids' => ['$productTax.id$'], |
| 194 | + 'tax_rate_ids' => ['$rate.id$'] |
| 195 | + ], |
| 196 | + 'rule' |
| 197 | + ) |
| 198 | + |
| 199 | + ] |
| 200 | + public function testRenderAmountMinimalProductWithTierPricesShouldShowMinTierPriceWithTaxes() |
| 201 | + { |
| 202 | + $result = $this->finalPriceBox->renderAmountMinimal(); |
| 203 | + $this->assertStringContainsString('$5.00', $result); |
| 204 | + } |
150 | 205 | }
|
0 commit comments