Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SaveAttributeOnProductPageStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\ObjectManager;
10 use Magento\Mtf\TestStep\TestStepInterface;
11 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
12 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
13 
17 class SaveAttributeOnProductPageStep implements TestStepInterface
18 {
24  protected $attribute;
25 
31  protected $objectManager;
32 
39 
46  public function __construct(
47  CatalogProductAttribute $attribute,
48  ObjectManager $objectManager,
49  CatalogProductEdit $catalogProductEdit
50  ) {
51  $this->attribute = $attribute;
52  $this->objectManager = $objectManager;
53  $this->catalogProductEdit = $catalogProductEdit;
54  }
55 
61  public function run()
62  {
63  $this->catalogProductEdit->getNewAttributeModal()->saveAttribute();
64  }
65 
71  public function cleanup()
72  {
73  $this->objectManager->create(
74  \Magento\Catalog\Test\TestStep\DeleteAttributeStep::class,
75  ['attribute' => $this->attribute]
76  )->run();
77  }
78 }
__construct(CatalogProductAttribute $attribute, ObjectManager $objectManager, CatalogProductEdit $catalogProductEdit)