/** * Delete custom URL Rewrite test. * * @param UrlRewrite $urlRewrite * @return void */ public function test(UrlRewrite $urlRewrite) { // Precondition $urlRewrite->persist(); // Steps $this->urlRewriteIndex->open(); $filter = ['request_path' => $urlRewrite->getIdentifier()]; $this->urlRewriteIndex->getUrlRedirectGrid()->searchAndOpen($filter); $this->urlRewriteEdit->getFormPageActions()->deleteAndAcceptAlert(); }
/** * 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(); }
/** * Run update product URL rewrite test. * * @param UrlRewrite $urlRewriteOrigin * @param UrlRewrite $urlRewrite * @return array */ public function test(UrlRewrite $urlRewriteOrigin, UrlRewrite $urlRewrite) { //Preconditions $urlRewriteOrigin->persist(); //Steps $this->urlRewriteIndex->open(); $filter = ['request_path' => $urlRewriteOrigin->getIdentifier()]; $this->urlRewriteIndex->getUrlRedirectGrid()->searchAndOpen($filter); $this->urlRewriteEdit->getEditForm()->fill($urlRewrite); $this->urlRewriteEdit->getFormPageActions()->save(); // Create new url rewrite fixture for asserts $data = array_merge($urlRewriteOrigin->getData(), $urlRewrite->getData()); $data['target_path'] = ['custom' => $urlRewriteOrigin->getTargetPath(), 'readyEntity' => $urlRewriteOrigin->getDataFieldConfig('target_path')['source']->getEntity()]; $data['store_id'] = ['data' => $urlRewriteOrigin->getStoreId()]; $urlRewrite = $this->fixtureFactory->createByCode('urlRewrite', ['data' => $data]); return ['urlRewrite' => $urlRewrite]; }
/** * 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]; }