10 use Magento\Catalog\Test\Page\Product\CatalogProductView;
11 use Magento\Checkout\Test\Page\CheckoutCart;
12 use Magento\Mtf\Client\BrowserInterface;
13 use Magento\Mtf\Constraint\AbstractConstraint;
41 CatalogProductView $catalogProductView,
44 BrowserInterface $browser,
45 BundleProduct $originalProduct =
null 47 $checkoutCartView->open()->getCartBlock()->clearShoppingCart();
49 $browser->open($_ENV[
'app_frontend_url'] .
$product->getUrlKey() .
'.html');
52 $this->
assertPrice($product, $catalogProductView, $checkoutCartView, $originalProduct);
68 CatalogProductView $catalogProductView,
70 BundleProduct $originalProduct =
null 73 $this->productPriceType = $originalProduct !==
null 74 ? $originalProduct->getPriceType()
76 $catalogProductView->getViewBlock()->addToCart(
$product);
77 $catalogProductView->getMessagesBlock()->waitSuccessMessage();
78 $checkoutCartView->open();
83 $fillData =
$product->getCheckoutData();
84 foreach ($fillData[
'options'][
'bundle_options'] as $key =>
$data) {
86 foreach ($bundleData[
'bundle_selections'][
'products'][$key] as $productKey => $itemProduct) {
87 if (strpos($itemProduct->getName(),
$data[
'value'][
'name']) !==
false) {
88 $data[
'value'][
'key'] = $productKey;
89 $subProductPrice = $itemProduct->getPrice();
93 $optionPrice[$key][
'price'] = $this->productPriceType ==
'No' 95 $bundleData[
'bundle_selections'][
'bundle_options'][$key][
'assigned_products'][
$data[
'value'][
'key']]
96 [
'data'][
'selection_price_value'],
99 : number_format($subProductPrice, 2);
103 $item[
'price'] -=
$item[
'price'] * $specialPrice;
104 \PHPUnit\Framework\Assert::assertEquals(
105 number_format(
$item[
'price'], 2),
107 'Bundle item ' . (
$index + 1) .
' options on frontend don\'t equal to fixture.' 110 $sumOptionsPrice =
$product->getDataFieldConfig(
'price')[
'source']->getPriceData()[
'cart_price'];
113 \PHPUnit\Framework\Assert::assertEquals(
116 'Bundle unit price on frontend doesn\'t equal to fixture.' 127 return 'Bundle price on shopping cart page is not correct.';
processAssert(CatalogProductView $catalogProductView, BundleProduct $product, CheckoutCart $checkoutCartView, BrowserInterface $browser, BundleProduct $originalProduct=null)
assertPrice(BundleProduct $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCartView, BundleProduct $originalProduct=null)