10 use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
29 CatalogProductSimple $initialProduct,
30 UrlRewriteIndex $urlRewriteIndex
32 $urlRewriteIndex->open();
33 $category =
$product->getDataFieldConfig(
'category_ids')[
'source']->getCategories()[0];
34 $targetPath =
"catalog/product/view/id/{$initialProduct->getId()}/category/{$category->getId()}";
37 'request_path' =>
$url,
38 'target_path' => $targetPath,
40 \PHPUnit\Framework\Assert::assertTrue(
41 $urlRewriteIndex->getUrlRedirectGrid()->isRowVisible($filter,
true,
false),
42 "URL Rewrite with request path '$url' is absent in grid." 45 $categoryInitial = $initialProduct->getDataFieldConfig(
'category_ids')[
'source']->getCategories()[0];
46 $targetPath =
"catalog/product/view/id/{$initialProduct->getId()}/category/{$categoryInitial->getId()}";
48 \PHPUnit\Framework\Assert::assertFalse(
49 $urlRewriteIndex->getUrlRedirectGrid()->isRowVisible([
'target_path' => $targetPath],
true,
false),
50 "URL Rewrite with target path '$targetPath' is present in grid." 61 return 'URL Rewrite for product was changed after assign category.';
processAssert(CatalogProductSimple $product, CatalogProductSimple $initialProduct, UrlRewriteIndex $urlRewriteIndex)