/**
  * Assert that link to Currently Published Revision on CMS Page Information Form is available.
  *
  * @param CmsRevisionEdit $cmsRevisionEdit
  * @param CmsPage $cms
  * @param CmsPageEdit $cmsPageEdit
  * @param CmsPageIndex $cmsPageIndex
  * @param array $results
  * @param Revision|null $revision [optional]
  * @return void
  */
 public function processAssert(CmsRevisionEdit $cmsRevisionEdit, CmsPage $cms, CmsPageEdit $cmsPageEdit, CmsPageIndex $cmsPageIndex, array $results, Revision $revision = null)
 {
     $filter = ['title' => $cms->getTitle()];
     $cmsPageIndex->open();
     $cmsPageIndex->getCmsPageGridBlock()->searchAndOpen($filter);
     $formPublishedRevision = $cmsPageEdit->getPageVersionsForm()->getCurrentlyPublishedRevisionText();
     \PHPUnit_Framework_Assert::assertEquals($cms->getTitle() . '; ' . $results['revision'], $formPublishedRevision, 'Link to Currently Published Revision not equals to passed in fixture.');
     $cmsPageEdit->getPageVersionsForm()->clickCurrentlyPublishedRevision();
     $formRevisionData = $cmsRevisionEdit->getRevisionForm()->getTabElement('content')->getContentData();
     $fixtureRevisionData['revision'] = $results['revisionKey'];
     $fixtureRevisionData['version'] = $cms->getTitle();
     $fixtureRevisionData['content'] = $revision !== null ? ['content' => $revision->getContent()] : $cms->getContent();
     $error = $this->verifyData($fixtureRevisionData, $formRevisionData);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
 /**
  * Run publish cms page revision test.
  *
  * @param CmsPage $cms
  * @param Revision $revision
  * @param int $initialRevision
  * @param int $revisionId
  * @return void
  */
 public function test(CmsPage $cms, Revision $revision, $initialRevision, $revisionId)
 {
     // Steps
     $this->cmsPageIndex->open();
     $title = $cms->getTitle();
     $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $title]);
     $this->cmsPageEdit->getPageVersionsForm()->openTab('versions');
     $filter = ['label' => $title];
     $revisionGrid = $this->cmsVersionEdit->getRevisionsGrid();
     $revisionForm = $this->cmsRevisionEdit->getRevisionForm();
     $this->cmsPageEdit->getPageVersionsForm()->getTabElement('versions')->getVersionsGrid()->searchAndOpen($filter);
     $revisionGrid->searchAndOpen(['revision_number_from' => $revisionId]);
     $revisionForm->toggleEditor();
     $revisionForm->fill($revision);
     $this->cmsRevisionEdit->getFormPageActions()->save();
     $filter = ['revision_number_from' => $initialRevision, 'revision_number_to' => $initialRevision];
     $revisionGrid->searchAndOpen($filter);
     $this->cmsRevisionEdit->getFormPageActions()->publish();
 }