/**
  * Create product URL Rewrite.
  *
  * @param UrlRewrite $urlRewrite
  * @return void
  */
 public function test(UrlRewrite $urlRewrite)
 {
     //Prepare data for tearDown
     $this->urlRewrite = $urlRewrite;
     //Precondition
     $product = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity();
     //Steps
     $this->urlRewriteIndex->open();
     $this->urlRewriteIndex->getGridPageActionBlock()->addNew();
     $this->urlRewriteSelect->getSelectTypeForm()->fill($urlRewrite);
     $this->urlRewriteSelectTypeProduct->getProductGridBlock()->searchAndOpen(['id' => $product->getId()]);
     $this->urlRewriteSelectTypeProductCategory->getCategoryTreeBlock()->skipCategorySelection();
     $this->urlRewriteEdit->getEditForm()->fill($urlRewrite);
     $this->urlRewriteEdit->getFormPageActions()->save();
 }
 /**
  * Create product URL Rewrite.
  *
  * @param CatalogProductSimple $product
  * @param UrlRewrite $urlRewrite
  * @return array
  */
 public function test(CatalogProductSimple $product, UrlRewrite $urlRewrite)
 {
     //Prepare data for tearDown
     $this->urlRewrite = $urlRewrite;
     //Precondition
     $product->persist();
     //Steps
     $filter = ['id' => $product->getId(), 'name' => $product->getName(), 'sku' => $product->getSku()];
     $this->urlRewriteIndex->open();
     $this->urlRewriteIndex->getGridPageActionBlock()->addNew();
     $this->urlRewriteSelect->getSelectTypeForm()->fill($urlRewrite);
     $this->urlRewriteSelectTypeProduct->getProductGridBlock()->searchAndOpen($filter);
     $this->urlRewriteSelectTypeProductCategory->getCategoryTreeBlock()->selectCategory($product->getCategoryIds());
     $this->urlRewriteEdit->getEditForm()->fill($urlRewrite);
     $this->urlRewriteEdit->getFormPageActions()->save();
     return ['product' => $product];
 }