Skip to content

Commit d080b80

Browse files
author
Dmytro Vilchynskyi
committed
MAGETWO-71515: Special/lowest price in child of a Configurable Product causes the entire product to show that price
- FAT
1 parent e4fb63f commit d080b80

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected function verifySpecialPrice()
138138
}
139139
$fixtureProductSpecialPrice = $this->product->getSpecialPrice();
140140
$fixtureProductSpecialPrice = number_format($fixtureProductSpecialPrice, 2);
141-
$formProductSpecialPrice = $this->productView->getPriceBlock()->getSpecialPrice();
141+
$formProductSpecialPrice = $this->productView->getPriceBlock($this->product)->getSpecialPrice();
142142
if ($fixtureProductSpecialPrice == $formProductSpecialPrice) {
143143
return null;
144144
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSpecialPriceOnProductPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function setErrorMessage($errorMessage)
6464
public function assertPrice(FixtureInterface $product, View $productViewBlock)
6565
{
6666
$fields = $product->getData();
67-
$specialPrice = $productViewBlock->getPriceBlock()->getSpecialPrice();
67+
$specialPrice = $productViewBlock->getPriceBlock($product)->getSpecialPrice();
6868
if (isset($fields['special_price'])) {
6969
\PHPUnit_Framework_Assert::assertEquals(
7070
number_format($fields['special_price'], 2),

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Product/Price.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\ConfigurableProduct\Test\Block\Product;
78

89
use Magento\Mtf\Client\Locator;
@@ -15,19 +16,35 @@
1516
class Price extends \Magento\Catalog\Test\Block\Product\Price
1617
{
1718
/**
18-
* A CSS selector for a price label.
19+
* A CSS selector for a Price label.
1920
*
2021
* @var string
2122
*/
2223
protected $priceLabel = '.normal-price .price-label';
2324

25+
/**
26+
* Mapping for different types of Price.
27+
*
28+
* @var array
29+
*/
30+
protected $mapTypePrices = [
31+
'special_price' => [
32+
'selector' => '.normal-price .price'
33+
]
34+
];
35+
2436
/**
2537
* This method returns the price represented by the block.
2638
*
2739
* @return SimpleElement
2840
*/
2941
public function getPriceLabel()
3042
{
31-
return $this->_rootElement->find($this->priceLabel, Locator::SELECTOR_CSS);
43+
return $this->_rootElement->find($this->priceLabel);
3244
}
45+
46+
// protected function init()
47+
// {
48+
// parent::init();
49+
// }
3350
}

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductPage.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
*/
1515
class AssertConfigurableProductPage extends AssertProductPage
1616
{
17+
18+
/**
19+
* Price format.
20+
*
21+
* @var int
22+
*/
23+
protected $priceFormat = 2;
24+
1725
/**
1826
* Verify displayed product data on product page(front-end) equals passed from fixture:
1927
* 1. Product Name
@@ -45,7 +53,7 @@ protected function verifyPrice()
4553
$formPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice();
4654
$fixturePrice = $this->getLowestConfigurablePrice();
4755

48-
if ($fixturePrice != $formPrice) {
56+
if ($fixturePrice != number_format($formPrice, $this->priceFormat)) {
4957
return "Displayed product price on product page(front-end) not equals passed from fixture. "
5058
. "Actual: {$formPrice}, expected: {$fixturePrice}.";
5159
}

0 commit comments

Comments
 (0)