/**
  * Assert that default qty for sub products in grouped product displays according to dataset on product page.
  *
  * @param CatalogProductView $groupedProductView
  * @param CatalogProductGrouped $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $groupedProductView, CatalogProductGrouped $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $groupedBlock = $groupedProductView->getGroupedViewBlock()->getGroupedProductBlock();
     $groupedProduct = $product->getData();
     foreach ($groupedProduct['associated']['assigned_products'] as $item) {
         \PHPUnit_Framework_Assert::assertEquals($groupedBlock->getQty($item['id']), $item['qty'], 'Default qty for sub product "' . $item['name'] . '" in grouped product according to dataset.');
     }
 }
 /**
  * Test update grouped product
  *
  * @param CatalogProductGrouped $product
  * @param CatalogProductGrouped $originalProduct
  * @return void
  */
 public function test(CatalogProductGrouped $product, CatalogProductGrouped $originalProduct)
 {
     // Precondition
     $originalProduct->persist();
     // Steps
     $this->catalogProductIndex->open();
     $this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $originalProduct->getSku()]);
     $this->catalogProductEdit->getForm()->fill($product);
     $this->catalogProductEdit->getFormAction()->save();
 }
 /**
  * Verify product price on grouped product view page
  *
  * @param CatalogProductGrouped $product
  * @param CatalogProductView $catalogProductView
  * @param AssertPriceOnProductPageInterface $object
  * @param Browser $browser
  * @param string $typePrice [optional]
  * @return bool|string
  */
 protected function processAssertPrice(CatalogProductGrouped $product, CatalogProductView $catalogProductView, AssertPriceOnProductPageInterface $object, Browser $browser, $typePrice = '')
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $groupedData = $product->getAssociated();
     /** @var InjectableFixture $subProduct */
     foreach ($groupedData['products'] as $key => $subProduct) {
         //Process assertions
         $catalogProductView->getGroupedViewBlock()->{'item' . $typePrice . 'PriceProductBlock'}(++$key);
         $object->setErrorMessage(sprintf($this->errorMessage, $subProduct->getData('name')));
         $object->assertPrice($subProduct, $catalogProductView, 'Grouped');
     }
 }