Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteAssignedToTemplateProductAttributeTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeIndex;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew;
12 use Magento\Mtf\TestCase\Injectable;
13 
31 {
32  /* tags */
33  const MVP = 'yes';
34  /* end tags */
35 
41  protected $attributeIndex;
42 
48  protected $attributeNew;
49 
57  public function __inject(CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)
58  {
59  $this->attributeIndex = $attributeIndex;
60  $this->attributeNew = $attributeNew;
61  }
62 
69  public function test(CatalogAttributeSet $attributeSet)
70  {
71  // Precondition
72  $attributeSet->persist();
73  $attribute = $attributeSet->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0];
74 
75  // Steps
76  $filter = ['attribute_code' => $attribute->getAttributeCode()];
77  $this->attributeIndex->open();
78  $this->attributeIndex->getGrid()->searchAndOpen($filter);
79  $this->attributeNew->getPageActions()->delete();
80  $this->attributeNew->getModalBlock()->acceptAlert();
81 
82  return ['attributeSet' => $attributeSet, 'attribute' => $attribute];
83  }
84 }
__inject(CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)