Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteAttributeSetTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetEdit;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetIndex;
12 use Magento\Mtf\Fixture\FixtureFactory;
13 use Magento\Mtf\TestCase\Injectable;
14 
33 class DeleteAttributeSetTest extends Injectable
34 {
35  /* tags */
36  const MVP = 'yes';
37  /* end tags */
38 
44  protected $productSetIndex;
45 
51  protected $productSetEdit;
52 
60  public function __inject(
61  CatalogProductSetIndex $productSetIndex,
62  CatalogProductSetEdit $productSetEdit
63  ) {
64  $this->productSetIndex = $productSetIndex;
65  $this->productSetEdit = $productSetEdit;
66  }
67 
75  public function test(FixtureFactory $fixtureFactory, CatalogAttributeSet $attributeSet)
76  {
77  // Precondition
78  $attributeSet->persist();
79  $product = $fixtureFactory->createByCode(
80  'catalogProductSimple',
81  [
82  'dataset' => 'default',
83  'data' => [
84  'attribute_set_id' => ['attribute_set' => $attributeSet],
85  ],
86  ]
87  );
88  $product->persist();
89 
90  // Steps
91  $filter = ['set_name' => $attributeSet->getAttributeSetName()];
92  $this->productSetIndex->open();
93  $this->productSetIndex->getGrid()->searchAndOpen($filter);
94  $this->productSetEdit->getPageActions()->delete();
95  $this->productSetEdit->getModalBlock()->acceptAlert();
96 
97  return ['product' => $product];
98  }
99 }
__inject(CatalogProductSetIndex $productSetIndex, CatalogProductSetEdit $productSetEdit)
test(FixtureFactory $fixtureFactory, CatalogAttributeSet $attributeSet)