Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateAttributeSetTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetEdit;
12 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetIndex;
13 use Magento\Mtf\TestCase\Injectable;
14 
35 class UpdateAttributeSetTest extends Injectable
36 {
37  /* tags */
38  const MVP = 'yes';
39  /* end tags */
40 
46  protected $productSetIndex;
47 
53  protected $productSetEdit;
54 
62  public function __inject(
63  CatalogProductSetIndex $productSetIndex,
64  CatalogProductSetEdit $productSetEdit
65  ) {
66  $this->productSetIndex = $productSetIndex;
67  $this->productSetEdit = $productSetEdit;
68  }
69 
78  public function test(
79  CatalogAttributeSet $attributeSet,
80  CatalogAttributeSet $attributeSetOriginal,
81  CatalogProductAttribute $productAttributeOriginal
82  ) {
83  // Precondition
84  $attributeSetOriginal->persist();
85  $productAttributeOriginal->persist();
86  // Steps
87  $filter = ['set_name' => $attributeSetOriginal->getAttributeSetName()];
88  $this->productSetIndex->open();
89  $this->productSetIndex->getGrid()->searchAndOpen($filter);
90  $groupName = $attributeSet->getGroup();
91  $this->productSetEdit->getAttributeSetEditBlock()->addAttributeSetGroup($groupName);
92  $this->productSetEdit->getAttributeSetEditBlock()
93  ->moveAttribute($productAttributeOriginal->getData(), $groupName);
94  $this->productSetEdit->getAttributeSetEditForm()->fill($attributeSet);
95  $this->productSetEdit->getPageActions()->save();
96  }
97 }
test(CatalogAttributeSet $attributeSet, CatalogAttributeSet $attributeSetOriginal, CatalogProductAttribute $productAttributeOriginal)
__inject(CatalogProductSetIndex $productSetIndex, CatalogProductSetEdit $productSetEdit)