Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateDuplicateUrlCategoryEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogCategoryEdit;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogCategoryIndex;
12 use Magento\Mtf\TestCase\Injectable;
13 
33 class CreateDuplicateUrlCategoryEntityTest extends Injectable
34 {
35  /* tags */
36  const MVP = 'yes';
37  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
38  /* end tags */
39 
46 
53 
61  public function __inject(CatalogCategoryIndex $catalogCategoryIndex, CatalogCategoryEdit $catalogCategoryEdit)
62  {
63  $this->catalogCategoryIndex = $catalogCategoryIndex;
64  $this->catalogCategoryEdit = $catalogCategoryEdit;
65  }
66 
74  public function test(Category $category, $addCategory)
75  {
76  for ($index = 0; $index < 2; $index++) {
77  // Duplicate category
78  $this->catalogCategoryIndex->open();
79  $this->catalogCategoryIndex->getTreeCategories()->selectCategory($category, false);
80  $this->catalogCategoryIndex->getTreeCategories()->$addCategory();
81  $this->catalogCategoryEdit->getEditForm()->fill($category);
82  $this->catalogCategoryEdit->getFormPageActions()->save();
83  }
84 
85  return ['category' => $category];
86  }
87 }
__inject(CatalogCategoryIndex $catalogCategoryIndex, CatalogCategoryEdit $catalogCategoryEdit)
$index
Definition: list.phtml:44