@@ -44,44 +44,29 @@ public function processAssert(
44
44
$ cmsIndex ->getLinksBlock ()->openLink ('My Account ' );
45
45
$ customerAccountIndex ->getAccountMenuBlock ()->openMenuItem ('My Wish List ' );
46
46
47
- $ isProductVisible = $ wishlistIndex ->getWishlistBlock ()->getProductItemsBlock ()->getItemProduct ($ product )
47
+ $ isProductVisible = $ wishlistIndex ->getWishlistBlock ()
48
+ ->getProductItemsBlock ()
49
+ ->getItemProduct ($ product )
48
50
->isVisible ();
49
51
while (!$ isProductVisible && $ wishlistIndex ->getTopToolbar ()->nextPage ()) {
50
- $ isProductVisible = $ wishlistIndex ->getWishlistBlock ()->getProductItemsBlock ()->getItemProduct ($ product )
52
+ $ isProductVisible = $ wishlistIndex ->getWishlistBlock ()
53
+ ->getProductItemsBlock ()
54
+ ->getItemProduct ($ product )
51
55
->isVisible ();
52
56
}
53
57
54
- $ productRegularPrice = 0 ;
55
58
if ($ product instanceof GroupedProduct) {
56
- $ associatedProducts = $ product ->getAssociated ();
57
-
58
- /** @var \Magento\Catalog\Test\Fixture\CatalogProductSimple $associatedProduct */
59
- foreach ($ associatedProducts ['products ' ] as $ key => $ associatedProduct ) {
60
- $ qty = $ associatedProducts ['assigned_products ' ][$ key ]['qty ' ];
61
- $ price = $ associatedProduct ->getPrice ();
62
- $ productRegularPrice += $ qty * $ price ;
63
- }
59
+ $ productRegularPrice = $ this ->getGroupedProductRegularPrice ($ product );
64
60
} elseif ($ product instanceof BundleProduct) {
65
- $ bundleSelection = (array )$ product ->getBundleSelections ();
66
- foreach ($ bundleSelection ['products ' ] as $ bundleOption ) {
67
- $ regularBundleProductPrice = 0 ;
68
- /** @var \Magento\Catalog\Test\Fixture\CatalogProductSimple $bundleProduct */
69
- foreach ($ bundleOption as $ bundleProduct ) {
70
- $ checkoutData = $ bundleProduct ->getCheckoutData ();
71
- $ bundleProductPrice = $ checkoutData ['qty ' ] * $ checkoutData ['cartItem ' ]['price ' ];
72
- if (0 === $ regularBundleProductPrice ) {
73
- $ regularBundleProductPrice = $ bundleProductPrice ;
74
- } else {
75
- $ regularBundleProductPrice = max ([$ bundleProductPrice , $ regularBundleProductPrice ]);
76
- }
77
- }
78
- $ productRegularPrice += $ regularBundleProductPrice ;
79
- }
61
+ $ productRegularPrice = $ this ->getBundleProductRegularPrice ($ product );
80
62
} else {
81
- $ productRegularPrice = (float )$ product ->getPrice ();
63
+ $ productRegularPrice = (float ) $ product ->getPrice ();
82
64
}
83
65
84
- $ productItem = $ wishlistIndex ->getWishlistBlock ()->getProductItemsBlock ()->getItemProduct ($ product );
66
+ $ productItem = $ wishlistIndex ->getWishlistBlock ()
67
+ ->getProductItemsBlock ()
68
+ ->getItemProduct ($ product );
69
+
85
70
$ wishListProductRegularPrice = $ product instanceof BundleProduct
86
71
? (float )$ productItem ->getPrice ()
87
72
: (float )$ productItem ->getRegularPrice ();
@@ -106,6 +91,52 @@ public function processAssert(
106
91
);
107
92
}
108
93
94
+ /**
95
+ * Retrieve grouped product regular price
96
+ *
97
+ * @param GroupedProduct $product
98
+ * @return float
99
+ */
100
+ private function getGroupedProductRegularPrice (GroupedProduct $ product )
101
+ {
102
+ $ productRegularPrice = 0 ;
103
+ $ associatedProducts = $ product ->getAssociated ();
104
+ /** @var \Magento\Catalog\Test\Fixture\CatalogProductSimple $associatedProduct */
105
+ foreach ($ associatedProducts ['products ' ] as $ key => $ associatedProduct ) {
106
+ $ qty = $ associatedProducts ['assigned_products ' ][$ key ]['qty ' ];
107
+ $ price = $ associatedProduct ->getPrice ();
108
+ $ productRegularPrice += $ qty * $ price ;
109
+ }
110
+ return $ productRegularPrice ;
111
+ }
112
+
113
+ /**
114
+ * Retrieve bundle product regular price
115
+ *
116
+ * @param BundleProduct $product
117
+ * @return float
118
+ */
119
+ private function getBundleProductRegularPrice (BundleProduct $ product )
120
+ {
121
+ $ productRegularPrice = 0 ;
122
+ $ bundleSelection = (array ) $ product ->getBundleSelections ();
123
+ foreach ($ bundleSelection ['products ' ] as $ bundleOption ) {
124
+ $ regularBundleProductPrice = 0 ;
125
+ /** @var \Magento\Catalog\Test\Fixture\CatalogProductSimple $bundleProduct */
126
+ foreach ($ bundleOption as $ bundleProduct ) {
127
+ $ checkoutData = $ bundleProduct ->getCheckoutData ();
128
+ $ bundleProductPrice = $ checkoutData ['qty ' ] * $ checkoutData ['cartItem ' ]['price ' ];
129
+ if (0 === $ regularBundleProductPrice ) {
130
+ $ regularBundleProductPrice = $ bundleProductPrice ;
131
+ } else {
132
+ $ regularBundleProductPrice = max ([$ bundleProductPrice , $ regularBundleProductPrice ]);
133
+ }
134
+ }
135
+ $ productRegularPrice += $ regularBundleProductPrice ;
136
+ }
137
+ return $ productRegularPrice ;
138
+ }
139
+
109
140
/**
110
141
* Returns a string representation of the object.
111
142
*
0 commit comments