Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateConfigurableProductEntityTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew;
13 use Magento\Mtf\TestCase\Injectable;
14 use Magento\Mtf\TestStep\TestStepFactory;
15 
41 class CreateConfigurableProductEntityTest extends Injectable
42 {
43  /* tags */
44  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
45  const MVP = 'yes';
46  /* end tags */
47 
53  protected $productIndex;
54 
60  protected $productNew;
61 
67  protected $testStepFactory;
68 
74  protected $configData = null;
75 
84  public function __inject(
85  CatalogProductIndex $productIndex,
86  CatalogProductNew $productNew,
87  TestStepFactory $testStepFactory
88  ) {
89  $this->productIndex = $productIndex;
90  $this->productNew = $productNew;
91  $this->testStepFactory = $testStepFactory;
92  }
93 
101  public function test(ConfigurableProduct $product, $configData = null)
102  {
103  //Preconditions
104  $this->configData = $configData;
105  $this->testStepFactory->create(
106  SetupConfigurationStep::class,
107  ['configData' => $this->configData, 'flushCache' => true]
108  )->run();
109 
110  // Steps
111  $this->productIndex->open();
112  $this->productIndex->getGridPageActionBlock()->addProduct('configurable');
113  $this->productNew->getProductForm()->fill($product);
114  $this->productNew->getFormPageActions()->save($product);
115  }
116 
120  public function teatDown()
121  {
122  $this->testStepFactory->create(
123  SetupConfigurationStep::class,
124  ['configData' => $this->configData, 'flushCache' => true]
125  )->cleanUp();
126  }
127 }
__inject(CatalogProductIndex $productIndex, CatalogProductNew $productNew, TestStepFactory $testStepFactory)