Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddAttributeToAttributeSetStep.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\TestStep\TestStepInterface;
14 
18 class AddAttributeToAttributeSetStep implements TestStepInterface
19 {
26 
33 
39  protected $attribute;
40 
46  protected $attributeSet;
47 
55  public function __construct(
56  CatalogProductSetIndex $catalogProductSetIndex,
57  CatalogProductSetEdit $catalogProductSetEdit,
58  CatalogProductAttribute $attribute,
59  CatalogAttributeSet $attributeSet
60  ) {
61  $this->catalogProductSetIndex = $catalogProductSetIndex;
62  $this->catalogProductSetEdit = $catalogProductSetEdit;
63  $this->attribute = $attribute;
64  $this->attributeSet = $attributeSet;
65  }
66 
72  public function run()
73  {
74  $filterAttribute = [
75  'set_name' => $this->attributeSet == null ? 'Default' : $this->attributeSet->getAttributeSetName()
76  ];
77  $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute);
78  $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData());
79  $this->catalogProductSetEdit->getPageActions()->save();
80  }
81 }
__construct(CatalogProductSetIndex $catalogProductSetIndex, CatalogProductSetEdit $catalogProductSetEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet)