/**
  * Assert prices on the product view Page
  *
  * @param BundleProduct $product
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 protected function assertPrice(BundleProduct $product, CatalogProductView $catalogProductView)
 {
     $priceData = $product->getDataFieldConfig('price')['source']->getPreset();
     $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock();
     $priceLow = $product->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice();
     \PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow, 'Bundle price From on product view page is not correct.');
     if ($product->getPriceView() == 'Price Range') {
         \PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo(), 'Bundle price To on product view page is not correct.');
     }
 }
 /**
  * Verify product price on category view page
  *
  * @param BundleProduct $bundle
  * @param CatalogCategoryView $catalogCategoryView
  * @return void
  */
 protected function assertPrice(BundleProduct $bundle, CatalogCategoryView $catalogCategoryView)
 {
     $priceData = $bundle->getDataFieldConfig('price')['source']->getPreset();
     //Price from/to verification
     $priceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($bundle->getName());
     $priceLow = $bundle->getPriceView() == 'Price Range' ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice();
     \PHPUnit_Framework_Assert::assertEquals($priceData['price_from'], $priceLow, 'Bundle price From on category page is not correct.');
     if ($bundle->getPriceView() == 'Price Range') {
         \PHPUnit_Framework_Assert::assertEquals($priceData['price_to'], $priceBlock->getPriceTo(), 'Bundle price To on category page is not correct.');
     }
 }
 /**
  * Test update bundle product
  *
  * @param BundleProduct $product
  * @param BundleProduct $originalProduct
  * @return array
  */
 public function test(BundleProduct $product, BundleProduct $originalProduct)
 {
     // Preconditions
     $originalProduct->persist();
     $originalCategory = $originalProduct->hasData('category_ids') ? $originalProduct->getDataFieldConfig('category_ids')['source']->getCategories() : null;
     $category = $product->hasData('category_ids') ? $product->getDataFieldConfig('category_ids')['source']->getCategories() : $originalCategory;
     // Steps
     $filter = ['sku' => $originalProduct->getSku()];
     $this->catalogProductIndex->open();
     $this->catalogProductIndex->getProductGrid()->searchAndOpen($filter);
     $this->catalogProductEdit->getProductForm()->fill($product);
     $this->catalogProductEdit->getFormPageActions()->save();
     return ['category' => $category];
 }