Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteUsedInConfigurableProductAttributeTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeIndex;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew;
13 use Magento\Mtf\TestCase\Injectable;
14 
35 {
36  /* tags */
37  const MVP = 'yes';
38  /* end tags */
39 
45  protected $attributeIndex;
46 
52  protected $attributeNew;
53 
61  public function __inject(CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)
62  {
63  $this->attributeIndex = $attributeIndex;
64  $this->attributeNew = $attributeNew;
65  }
66 
73  public function test(ConfigurableProduct $product)
74  {
75  // Precondition
76  $product->persist();
78  $attribute = $product->getDataFieldConfig('configurable_attributes_data')['source']
79  ->getAttributes()['attribute_key_0'];
80  // Steps
81  $this->attributeIndex->open();
82  $this->attributeIndex->getGrid()->searchAndOpen(['attribute_code' => $attribute->getAttributeCode()]);
83  $this->attributeNew->getPageActions()->delete();
84  $this->attributeNew->getModalBlock()->acceptAlert();
85 
86  return ['attribute' => $attribute];
87  }
88 }
__inject(CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)