/** * Update CMS Page. * * @param CmsPage $cms * @param CmsPage $cmsOriginal * @return array */ public function test(CmsPage $cms, CmsPage $cmsOriginal) { // Steps $this->cmsPageIndex->open(); $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]); $this->cmsPageNew->getPageForm()->fill($cms); $this->cmsPageNew->getPageMainActions()->save(); return ['cms' => $this->factory->createByCode('cmsPage', ['data' => array_merge($cmsOriginal->getData(), $cms->getData())])]; }
/** * Delete CMS Page. * * @param CmsPage $cmsPage * @return void */ public function test(CmsPage $cmsPage) { // Preconditions $cmsPage->persist(); // Steps $this->cmsPageIndex->open(); $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsPage->getTitle()]); $this->cmsPageNew->getPageMainActions()->delete(); }
/** * Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend. * * @param CmsPage $cms * @param FrontCmsIndex $frontCmsIndex * @param CmsPageIndex $cmsIndex * @param BrowserInterface $browser * @return void */ public function processAssert(CmsPage $cms, FrontCmsIndex $frontCmsIndex, CmsPageIndex $cmsIndex, BrowserInterface $browser) { $cmsIndex->open(); $filter = ['title' => $cms->getTitle()]; $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); $browser->selectWindow(); \PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $frontCmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.'); }
/** * Assert that displayed CMS page data on edit page equals passed from fixture. * * @param CmsPage $cms * @param CmsPageIndex $cmsIndex * @param CmsPageNew $cmsPageNew * @return void */ public function processAssert(CmsPage $cms, CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew) { $cmsIndex->open(); $filter = ['title' => $cms->getTitle()]; $cmsIndex->getCmsPageGridBlock()->searchAndOpen($filter); $cmsFormData = $cmsPageNew->getPageForm()->getData($cms); $cmsFormData['store_id'] = implode('/', $cmsFormData['store_id']); $errors = $this->verifyData($cms->getData(), $cmsFormData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Assert that content of created cms page displayed in section 'maincontent' and equals passed from fixture. * * @param CmsPageIndex $cmsIndex * @param FrontCmsIndex $frontCmsIndex * @param FrontCmsPage $frontCmsPage * @param CmsPage $cms * @param BrowserInterface $browser * @return void */ public function processAssert(CmsPageIndex $cmsIndex, FrontCmsIndex $frontCmsIndex, FrontCmsPage $frontCmsPage, CmsPage $cms, BrowserInterface $browser) { $cmsIndex->open(); $filter = ['title' => $cms->getTitle()]; $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); $browser->selectWindow(); $fixtureContent = $cms->getContent(); \PHPUnit_Framework_Assert::assertContains($fixtureContent['content'], $frontCmsPage->getCmsPageBlock()->getPageContent(), 'Wrong content is displayed.'); if (isset($fixtureContent['widget'])) { foreach ($fixtureContent['widget']['preset'] as $widget) { \PHPUnit_Framework_Assert::assertTrue($frontCmsPage->getCmsPageBlock()->isWidgetVisible($widget['widget_type'], $widget['anchor_text']), 'Widget \'' . $widget['widget_type'] . '\' is not displayed.'); } } if ($cms->getContentHeading()) { \PHPUnit_Framework_Assert::assertEquals($cms->getContentHeading(), $frontCmsIndex->getTitleBlock()->getTitle(), 'Wrong title is displayed.'); } }
/** * Assert that Cms page is not present in pages grid. * * @param CmsPageIndex $cmsIndex * @param CmsPage $cmsPage * @return void */ public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cmsPage) { $filter = ['title' => $cmsPage->getTitle()]; \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getCmsPageGridBlock()->isRowVisible($filter), 'Cms page \'' . $cmsPage->getTitle() . '\' is present in pages grid.'); }
/** * Assert that cms page is present in pages grid. * * @param CmsPageIndex $cmsIndex * @param CmsPage $cms * @return void */ public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cms) { $filter = ['title' => $cms->getTitle()]; $cmsIndex->open(); \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getCmsPageGridBlock()->isRowVisible($filter, true, false), 'Cms page \'' . $cms->getTitle() . '\' is not present in pages grid.'); }