6 declare(strict_types=1);
10 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Customer\Test\Page\CustomerAccountIndex;
12 use Magento\Wishlist\Test\Page\WishlistIndex;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 use Magento\Mtf\Fixture\InjectableFixture;
26 private $regularPriceLabel =
'Regular Price';
37 public function processAssert(
39 CustomerAccountIndex $customerAccountIndex,
40 WishlistIndex $wishlistIndex,
44 $cmsIndex->getLinksBlock()->openLink(
'My Account');
45 $customerAccountIndex->getAccountMenuBlock()->openMenuItem(
'My Wish List');
47 $productRegularPrice = 0;
48 if (
$product instanceof GroupedProduct) {
49 $associatedProducts =
$product->getAssociated();
52 foreach ($associatedProducts[
'products'] as $key => $associatedProduct) {
53 $qty = $associatedProducts[
'assigned_products'][$key][
'qty'];
54 $price = $associatedProduct->getPrice();
55 $productRegularPrice += $qty *
$price;
58 $bundleSelection = (array)
$product->getBundleSelections();
59 foreach ($bundleSelection[
'products'] as $bundleOption) {
60 $regularBundleProductPrice = 0;
64 $bundleProductPrice = $checkoutData[
'qty'] * $checkoutData[
'cartItem'][
'price'];
65 if (0 === $regularBundleProductPrice) {
66 $regularBundleProductPrice = $bundleProductPrice;
68 $regularBundleProductPrice = max([$bundleProductPrice, $regularBundleProductPrice]);
71 $productRegularPrice += $regularBundleProductPrice;
74 $productRegularPrice = (float)
$product->getPrice();
77 $productItem = $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct(
$product);
78 $wishListProductRegularPrice = (float)$productItem->getRegularPrice();
80 \PHPUnit\Framework\Assert::assertEquals(
81 $this->regularPriceLabel,
82 $productItem->getPriceLabel(),
83 'Wrong product regular price is displayed.' 86 \PHPUnit\Framework\Assert::assertNotEmpty(
87 $wishListProductRegularPrice,
88 'Regular Price for "' .
$product->getName() .
'" is not correct.' 91 \PHPUnit\Framework\Assert::assertEquals(
93 $wishListProductRegularPrice,
94 'Wrong product regular price is displayed.' 105 return 'Product is displayed with correct regular price.';
elseif(isset( $params[ 'redirect_parent']))