Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateCmsPageEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex;
11 use Magento\Cms\Test\Page\Adminhtml\CmsPageNew;
12 use Magento\Mtf\Fixture\FixtureFactory;
13 use Magento\Mtf\TestCase\Injectable;
14 
30 class UpdateCmsPageEntityTest extends Injectable
31 {
32  /* tags */
33  const MVP = 'yes';
34  const SEVERITY = 'S1';
35  /* end tags */
36 
42  protected $cmsPageIndex;
43 
49  protected $cmsPageNew;
50 
56  protected $factory;
57 
67  public function __inject(
68  CmsPageIndex $cmsPageIndex,
69  CmsPageNew $cmsPageNew,
70  CmsPage $cmsOriginal,
71  FixtureFactory $factory
72  ) {
73  $cmsOriginal->persist();
74  $this->cmsPageIndex = $cmsPageIndex;
75  $this->cmsPageNew = $cmsPageNew;
76  $this->factory = $factory;
77  return ['cmsOriginal' => $cmsOriginal];
78  }
79 
87  public function test(CmsPage $cms, CmsPage $cmsOriginal)
88  {
89  // Steps
90  $this->cmsPageIndex->open();
91  $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]);
92  $this->cmsPageNew->getPageForm()->fill($cms);
93  $this->cmsPageNew->getPageMainActions()->save();
94 
95  return [
96  'cms' => $this->factory->createByCode(
97  'cmsPage',
98  ['data' => array_merge($cmsOriginal->getData(), $cms->getData())]
99  )
100  ];
101  }
102 }
__inject(CmsPageIndex $cmsPageIndex, CmsPageNew $cmsPageNew, CmsPage $cmsOriginal, FixtureFactory $factory)