Skip to content

Commit d8db423

Browse files
committed
MC-22569: Storefront: Check special/tier/group/rule/option price for product
1 parent 499a06f commit d8db423

12 files changed

+45
-125
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ protected function setUp()
5959
/**
6060
* Assert that product price without additional price configurations will render as expected.
6161
*
62-
* @magentoDataFixture Magento/Catalog/_files/product_simple_without_price_configurations.php
62+
* @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php
6363
*
6464
* @return void
6565
*/
6666
public function testCheckProductPriceWithoutAdditionalPriceConfigurations(): void
6767
{
68-
$priceHtml = $this->getProductPriceHtml('simple_product');
69-
$this->assertFinalPrice($priceHtml, 50.00);
68+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
69+
$this->assertFinalPrice($priceHtml, 205.00);
7070
}
7171

7272
/**
@@ -92,8 +92,8 @@ public function testCheckSpecialPrice(): void
9292
*/
9393
public function testCheckFixedTierPrice(): void
9494
{
95-
$priceHtml = $this->getProductPriceHtml('simple_product');
96-
$this->assertFinalPrice($priceHtml, 50.00);
95+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
96+
$this->assertFinalPrice($priceHtml, 205.00);
9797
$this->assertAsLowAsPrice($priceHtml, 40.00);
9898
}
9999

@@ -106,9 +106,9 @@ public function testCheckFixedTierPrice(): void
106106
*/
107107
public function testCheckPercentTierPrice(): void
108108
{
109-
$priceHtml = $this->getProductPriceHtml('simple_product');
110-
$this->assertFinalPrice($priceHtml, 50.00);
111-
$this->assertAsLowAsPrice($priceHtml, 25.00);
109+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
110+
$this->assertFinalPrice($priceHtml, 205.00);
111+
$this->assertAsLowAsPrice($priceHtml, 102.50);
112112
}
113113

114114
/**
@@ -120,9 +120,9 @@ public function testCheckPercentTierPrice(): void
120120
*/
121121
public function testCheckFixedTierPriceForNotLoggedUser(): void
122122
{
123-
$priceHtml = $this->getProductPriceHtml('simple_product');
123+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
124124
$this->assertFinalPrice($priceHtml, 30.00);
125-
$this->assertRegularPrice($priceHtml, 50.00);
125+
$this->assertRegularPrice($priceHtml, 205.00);
126126
}
127127

128128
/**
@@ -138,14 +138,14 @@ public function testCheckFixedTierPriceForNotLoggedUser(): void
138138
*/
139139
public function testCheckFixedTierPriceForLoggedUser(): void
140140
{
141-
$priceHtml = $this->getProductPriceHtml('simple_product');
142-
$this->assertFinalPrice($priceHtml, 50.00);
141+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
142+
$this->assertFinalPrice($priceHtml, 205.00);
143143
$this->assertNotRegExp('/\$10/', $priceHtml);
144144
$this->customerSession->setCustomerId(1);
145145
try {
146-
$priceHtml = $this->getProductPriceHtml('simple_product');
146+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
147147
$this->assertFinalPrice($priceHtml, 10.00);
148-
$this->assertRegularPrice($priceHtml, 50.00);
148+
$this->assertRegularPrice($priceHtml, 205.00);
149149
} finally {
150150
$this->customerSession->setCustomerId(null);
151151
}
@@ -155,7 +155,7 @@ public function testCheckFixedTierPriceForLoggedUser(): void
155155
* Assert that price of product with catalog rule with action equal to "Apply as percentage of original"
156156
* is renders correctly.
157157
*
158-
* @magentoDataFixture Magento/Catalog/_files/product_simple_without_price_configurations.php
158+
* @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php
159159
* @magentoDataFixture Magento/CatalogRule/_files/rule_apply_as_percentage_of_original_not_logged_user.php
160160
* @magentoDbIsolation disabled
161161
* @magentoAppArea frontend
@@ -164,16 +164,16 @@ public function testCheckFixedTierPriceForLoggedUser(): void
164164
*/
165165
public function testCheckPriceRendersCorrectlyWithApplyAsPercentageOfOriginalRule(): void
166166
{
167-
$priceHtml = $this->getProductPriceHtml('simple_product');
168-
$this->assertFinalPrice($priceHtml, 45.00);
169-
$this->assertRegularPrice($priceHtml, 50.00);
167+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
168+
$this->assertFinalPrice($priceHtml, 184.50);
169+
$this->assertRegularPrice($priceHtml, 205.00);
170170
}
171171

172172
/**
173173
* Assert that price of product with catalog rule with action equal to "Apply as fixed amount"
174174
* is renders correctly.
175175
*
176-
* @magentoDataFixture Magento/Catalog/_files/product_simple_without_price_configurations.php
176+
* @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php
177177
* @magentoDataFixture Magento/CatalogRule/_files/rule_apply_as_fixed_amount_not_logged_user.php
178178
* @magentoDbIsolation disabled
179179
* @magentoAppArea frontend
@@ -182,16 +182,16 @@ public function testCheckPriceRendersCorrectlyWithApplyAsPercentageOfOriginalRul
182182
*/
183183
public function testCheckPriceRendersCorrectlyWithApplyAsFixedAmountRule(): void
184184
{
185-
$priceHtml = $this->getProductPriceHtml('simple_product');
186-
$this->assertFinalPrice($priceHtml, 40.00);
187-
$this->assertRegularPrice($priceHtml, 50.00);
185+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
186+
$this->assertFinalPrice($priceHtml, 195.00);
187+
$this->assertRegularPrice($priceHtml, 205.00);
188188
}
189189

190190
/**
191191
* Assert that price of product with catalog rule with action equal to "Adjust final price to this percentage"
192192
* is renders correctly.
193193
*
194-
* @magentoDataFixture Magento/Catalog/_files/product_simple_without_price_configurations.php
194+
* @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php
195195
* @magentoDataFixture Magento/CatalogRule/_files/rule_adjust_final_price_to_this_percentage_not_logged_user.php
196196
* @magentoDbIsolation disabled
197197
* @magentoAppArea frontend
@@ -200,16 +200,16 @@ public function testCheckPriceRendersCorrectlyWithApplyAsFixedAmountRule(): void
200200
*/
201201
public function testCheckPriceRendersCorrectlyWithAdjustFinalPriceToThisPercentageRule(): void
202202
{
203-
$priceHtml = $this->getProductPriceHtml('simple_product');
204-
$this->assertFinalPrice($priceHtml, 5.00);
205-
$this->assertRegularPrice($priceHtml, 50.00);
203+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
204+
$this->assertFinalPrice($priceHtml, 20.50);
205+
$this->assertRegularPrice($priceHtml, 205.00);
206206
}
207207

208208
/**
209209
* Assert that price of product with catalog rule with action equal to "Adjust final price to discount value"
210210
* is renders correctly.
211211
*
212-
* @magentoDataFixture Magento/Catalog/_files/product_simple_without_price_configurations.php
212+
* @magentoDataFixture Magento/Catalog/_files/product_simple_tax_none.php
213213
* @magentoDataFixture Magento/CatalogRule/_files/rule_adjust_final_price_to_discount_value_not_logged_user.php
214214
* @magentoDbIsolation disabled
215215
* @magentoAppArea frontend
@@ -218,9 +218,9 @@ public function testCheckPriceRendersCorrectlyWithAdjustFinalPriceToThisPercenta
218218
*/
219219
public function testCheckPriceRendersCorrectlyWithAdjustFinalPriceToDiscountValueRule(): void
220220
{
221-
$priceHtml = $this->getProductPriceHtml('simple_product');
221+
$priceHtml = $this->getProductPriceHtml('simple-product-tax-none');
222222
$this->assertFinalPrice($priceHtml, 10.00);
223-
$this->assertRegularPrice($priceHtml, 50.00);
223+
$this->assertRegularPrice($priceHtml, 205.00);
224224
}
225225

226226
/**

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_tax_none_rollback.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,25 @@
55
*/
66
declare(strict_types=1);
77

8-
use Magento\Catalog\Api\Data\ProductInterface;
98
use Magento\Catalog\Api\ProductRepositoryInterface;
109
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Framework\Registry;
1111
use Magento\TestFramework\Helper\Bootstrap;
1212
use Magento\TestFramework\ObjectManager;
1313

1414
/** @var ObjectManager $objectManager */
1515
$objectManager = Bootstrap::getObjectManager();
1616
/** @var ProductRepositoryInterface $productRepository */
1717
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
18-
/** @var \Magento\Framework\Registry $registry */
19-
$registry =$objectManager->get(\Magento\Framework\Registry::class);
20-
18+
/** @var Registry $registry */
19+
$registry = $objectManager->get(Registry::class);
2120
$registry->unregister('isSecureArea');
2221
$registry->register('isSecureArea', true);
23-
2422
try {
25-
/** @var ProductInterface $product */
26-
$product = $productRepository->get('simple-product-tax-none', false, null, true);
23+
$product = $productRepository->get('simple-product-tax-none');
2724
$productRepository->delete($product);
2825
} catch (NoSuchEntityException $e) {
2926
// isolation on
3027
}
31-
3228
$registry->unregister('isSecureArea');
3329
$registry->register('isSecureArea', false);

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
use Magento\Customer\Model\Group;
1111
use Magento\Store\Api\WebsiteRepositoryInterface;
1212

13-
require __DIR__ . '/product_simple_without_price_configurations.php';
13+
require __DIR__ . '/product_simple_tax_none.php';
1414

15+
$product = $productRepository->get('simple-product-tax-none');
1516
/** @var WebsiteRepositoryInterface $websiteRepository */
1617
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
1718
/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory;
1010
use Magento\Store\Api\WebsiteRepositoryInterface;
1111

12-
require __DIR__ . '/product_simple_without_price_configurations.php';
12+
require __DIR__ . '/product_simple_tax_none.php';
1313

14+
$product = $productRepository->get('simple-product-tax-none');
1415
/** @var WebsiteRepositoryInterface $websiteRepository */
1516
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
1617
/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_logged_user_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
declare(strict_types=1);
77

8-
require __DIR__ . '/product_simple_without_price_configurations_rollback.php';
8+
require __DIR__ . '/product_simple_tax_none_rollback.php';

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
use Magento\Customer\Model\Group;
1111
use Magento\Store\Api\WebsiteRepositoryInterface;
1212

13-
require __DIR__ . '/product_simple_without_price_configurations.php';
13+
require __DIR__ . '/product_simple_tax_none.php';
1414

15+
$product = $productRepository->get('simple-product-tax-none');
1516
/** @var WebsiteRepositoryInterface $websiteRepository */
1617
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
1718
/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_for_not_logged_user_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
declare(strict_types=1);
77

8-
require __DIR__ . '/product_simple_without_price_configurations_rollback.php';
8+
require __DIR__ . '/product_simple_tax_none_rollback.php';

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_fixed_tier_price_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
declare(strict_types=1);
77

8-
require __DIR__ . '/product_simple_without_price_configurations_rollback.php';
8+
require __DIR__ . '/product_simple_tax_none_rollback.php';

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
use Magento\Customer\Model\Group;
1111
use Magento\Store\Api\WebsiteRepositoryInterface;
1212

13-
require __DIR__ . '/product_simple_without_price_configurations.php';
13+
require __DIR__ . '/product_simple_tax_none.php';
1414

15+
$product = $productRepository->get('simple-product-tax-none');
1516
/** @var WebsiteRepositoryInterface $websiteRepository */
1617
$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class);
1718
/** @var ProductTierPriceInterfaceFactory $tierPriceFactory */

dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_percent_tier_price_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
declare(strict_types=1);
77

8-
require __DIR__ . '/product_simple_without_price_configurations_rollback.php';
8+
require __DIR__ . '/product_simple_tax_none_rollback.php';

0 commit comments

Comments
 (0)