Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateCmsPageEntityTest.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex;
12 use Magento\Cms\Test\Page\Adminhtml\CmsPageNew;
13 use Magento\Mtf\Fixture\FixtureFactory;
14 use Magento\Mtf\TestCase\Injectable;
15 
28 class CreateCmsPageEntityTest extends Injectable
29 {
30  /* tags */
31  const MVP = 'yes';
32  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
33  const SEVERITY = 'S1';
34  /* end tags */
35 
41  protected $cmsIndex;
42 
48  protected $cmsPageNew;
49 
55  protected $fixtureFactory;
56 
62  private $configData;
63 
72  public function __inject(CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew, FixtureFactory $fixtureFactory)
73  {
74  $this->cmsIndex = $cmsIndex;
75  $this->cmsPageNew = $cmsPageNew;
76  $this->fixtureFactory = $fixtureFactory;
77  }
78 
87  public function test(array $data, $fixtureType, $configData = '')
88  {
89  $this->configData = $configData;
90 
91  // Preconditions
92  $this->objectManager->create(
93  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
94  ['configData' => $configData]
95  )->run();
96  // Steps
97  $cms = $this->fixtureFactory->createByCode($fixtureType, ['data' => $data]);
98  $this->cmsIndex->open();
99  $this->cmsIndex->getPageActionsBlock()->addNew();
100  $this->cmsPageNew->getPageForm()->fill($cms);
101  $this->cmsPageNew->getPageMainActions()->save();
102 
103  return ['cms' => $cms];
104  }
105 
111  public function tearDown()
112  {
113  if ($this->configData) {
114  $this->objectManager->create(
115  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
116  ['configData' => 'enable_single_store_mode', 'rollback' => true]
117  )->run();
118  }
119  }
120 }
__inject(CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew, FixtureFactory $fixtureFactory)
test(array $data, $fixtureType, $configData='')