Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateDuplicateUrlProductEntity.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
12 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew;
13 use Magento\Mtf\TestCase\Injectable;
14 
31 class CreateDuplicateUrlProductEntity extends Injectable
32 {
33  /* tags */
34  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
35  const MVP = 'yes';
36  /* end tags */
37 
43  private $configData;
44 
50  private $flushCache;
51 
58  public function __prepare(Category $category)
59  {
60  $category->persist();
61 
62  return [
63  'category' => $category
64  ];
65  }
66 
78  public function testCreate(
79  CatalogProductSimple $product,
80  Category $category,
81  CatalogProductIndex $productGrid,
82  CatalogProductNew $newProductPage,
83  $flushCache = false,
84  $configData = null
85  ) {
86  $this->configData = $configData;
87  $this->flushCache = $flushCache;
88 
89  // Preconditions
90  $this->objectManager->create(
91  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
92  ['configData' => $this->configData, 'flushCache' => $this->flushCache]
93  )->run();
94 
95  for ($index = 0; $index < 2; $index++) {
96  // Duplicate product
97  $productGrid->open();
98  $productGrid->getGridPageActionBlock()->addProduct('simple');
99  $newProductPage->getProductForm()->fill($product, null, $category);
100  $newProductPage->getFormPageActions()->save();
101  }
102 
103  return ['product' => $product];
104  }
105 
111  public function tearDown()
112  {
113  $this->objectManager->create(
114  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
115  ['configData' => $this->configData, 'rollback' => true, 'flushCache' => $this->flushCache]
116  )->run();
117  }
118 }
testCreate(CatalogProductSimple $product, Category $category, CatalogProductIndex $productGrid, CatalogProductNew $newProductPage, $flushCache=false, $configData=null)
$index
Definition: list.phtml:44