Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SaveAttributeStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew;
10 use Magento\Mtf\ObjectManager;
11 use Magento\Mtf\TestStep\TestStepInterface;
12 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
13 
17 class SaveAttributeStep implements TestStepInterface
18 {
24  protected $attributeNew;
25 
31  protected $attribute;
32 
38  protected $objectManager;
39 
46  public function __construct(
47  CatalogProductAttributeNew $attributeNew,
48  CatalogProductAttribute $attribute,
49  ObjectManager $objectManager
50  ) {
51  $this->attributeNew = $attributeNew;
52  $this->attribute = $attribute;
53  $this->objectManager = $objectManager;
54  }
55 
61  public function run()
62  {
63  $this->attributeNew->getPageActions()->save();
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(CatalogProductAttributeNew $attributeNew, CatalogProductAttribute $attribute, ObjectManager $objectManager)