Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateVirtualProductEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Fixture\CatalogProductVirtual;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
12 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew;
13 use Magento\Mtf\TestCase\Injectable;
14 
29 class CreateVirtualProductEntityTest extends Injectable
30 {
31  /* tags */
32  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
33  const MVP = 'no';
34  /* end tags */
35 
41  protected $category;
42 
48  protected $productGrid;
49 
55  protected $newProductPage;
56 
63  public function __prepare(Category $category)
64  {
65  $category->persist();
66  return [
67  'category' => $category
68  ];
69  }
70 
78  public function __inject(CatalogProductIndex $productGrid, CatalogProductNew $newProductPage)
79  {
80  $this->productGrid = $productGrid;
81  $this->newProductPage = $newProductPage;
82  }
83 
91  public function testCreate(CatalogProductVirtual $product, Category $category)
92  {
93  // Steps
94  $this->productGrid->open();
95  $this->productGrid->getGridPageActionBlock()->addProduct('virtual');
96  $this->newProductPage->getProductForm()->fill($product, null, $category);
97  $this->newProductPage->getFormPageActions()->save();
98  }
99 }
__inject(CatalogProductIndex $productGrid, CatalogProductNew $newProductPage)