Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateDuplicateUrlCmsPageEntityTest.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 
33 class CreateDuplicateUrlCmsPageEntityTest extends Injectable
34 {
35  /* tags */
36  const MVP = 'yes';
37  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
38  const SEVERITY = 'S1';
39  /* end tags */
40 
46  protected $cmsIndex;
47 
53  protected $cmsPageNew;
54 
60  protected $fixtureFactory;
61 
67  private $configData;
68 
77  public function __inject(CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew, FixtureFactory $fixtureFactory)
78  {
79  $this->cmsIndex = $cmsIndex;
80  $this->cmsPageNew = $cmsPageNew;
81  $this->fixtureFactory = $fixtureFactory;
82  }
83 
92  public function test(array $data, $fixtureType, $configData = '')
93  {
94  $this->configData = $configData;
95 
96  // Preconditions
97  $this->objectManager->create(
98  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
99  ['configData' => $configData]
100  )->run();
101 
102  $cmsPage = $this->fixtureFactory->createByCode($fixtureType, ['data' => $data]);
103 
104  for ($index = 0; $index < 2; $index++) {
105  // Duplicate page
106  $this->cmsIndex->open();
107  $this->cmsIndex->getPageActionsBlock()->addNew();
108  $this->cmsPageNew->getPageForm()->fill($cmsPage);
109  $this->cmsPageNew->getPageMainActions()->save();
110  }
111 
112  return ['cmsPage' => $cmsPage];
113  }
114 
120  public function tearDown()
121  {
122  if ($this->configData) {
123  $this->objectManager->create(
124  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
125  ['configData' => 'enable_single_store_mode', 'rollback' => true]
126  )->run();
127  }
128  }
129 }
$index
Definition: list.phtml:44
__inject(CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew, FixtureFactory $fixtureFactory)