/**
  * Assert that created CMS page displays with error message on unassigned store views on frontend.
  *
  * @param CmsPage $cms
  * @param FrontendCmsPage $frontendCmsPage
  * @param Browser $browser
  * @param CmsIndex $cmsIndex
  * @param string|null $notFoundMessage
  * @return void
  */
 public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser, CmsIndex $cmsIndex, $notFoundMessage = null)
 {
     $browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
     $notFoundMessage = $notFoundMessage !== null ? $notFoundMessage : self::ERROR_MESSAGE;
     $cmsIndex->getHeaderBlock()->selectStore('Default Store View');
     \PHPUnit_Framework_Assert::assertContains($notFoundMessage, $frontendCmsPage->getCmsPageContentBlock()->getPageContent(), 'Wrong page content is displayed.');
 }
 /**
  * Assert that sitemap.xml file contains correct content according to dataset:
  *  - product url
  *  - category url
  *  - CMS page url
  *
  * @param CatalogProductSimple $product
  * @param CatalogCategory $category
  * @param CmsPage $cmsPage
  * @param Sitemap $sitemap
  * @param SitemapIndex $sitemapIndex
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, CatalogCategory $category, CmsPage $cmsPage, Sitemap $sitemap, SitemapIndex $sitemapIndex)
 {
     $sitemapIndex->open()->getSitemapGrid()->sortGridByField('sitemap_id');
     $filter = ['sitemap_filename' => $sitemap->getSitemapFilename(), 'sitemap_path' => $sitemap->getSitemapPath()];
     $sitemapIndex->getSitemapGrid()->search($filter);
     $content = file_get_contents($sitemapIndex->getSitemapGrid()->getLinkForGoogle());
     $frontendUrl = str_replace('index.php/', '', $_ENV['app_frontend_url']);
     $urls = [$frontendUrl . $product->getUrlKey() . '.html', $frontendUrl . $category->getUrlKey() . '.html', $frontendUrl . $cmsPage->getIdentifier()];
     \PHPUnit_Framework_Assert::assertTrue($this->checkContent($content, $urls), "File '{$sitemap->getSitemapFilename()}' does not contains correct content.");
 }
 /**
  * Assert that CMS page cann't be found in grid via:
  * - Page title type
  * - Url Key
  * - Status
  *
  * @param CmsPageIndex $cmsIndex
  * @param CmsPage $cmsPage
  * @return void
  */
 public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cmsPage)
 {
     $cmsIndex->open();
     $filter = ['title' => $cmsPage->getTitle(), 'identifier' => $cmsPage->getIdentifier(), 'is_active' => $cmsPage->getIsActive()];
     \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getCmsPageGridBlock()->isRowVisible($filter), "Cms page {$cmsPage->getTitle()} is present in pages grid.");
 }
 /**
  * Assert that created CMS page with status "disabled" displays with error message on frontend.
  *
  * @param CmsPage $cms
  * @param FrontendCmsPage $frontendCmsPage
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
     \PHPUnit_Framework_Assert::assertEquals(self::ERROR_MESSAGE, $frontendCmsPage->getCmsPageContentBlock()->getPageHeadTitle(), 'Wrong page is displayed.');
 }
 /**
  * Assert that created CMS page displays with error message on unassigned store views on frontend.
  *
  * @param CmsPage $cms
  * @param FrontendCmsPage $frontendCmsPage
  * @param Browser $browser
  * @param CmsIndex $cmsIndex
  * @return void
  */
 public function processAssert(CmsPage $cms, FrontendCmsPage $frontendCmsPage, Browser $browser, CmsIndex $cmsIndex)
 {
     $browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
     $cmsIndex->getHeaderBlock()->selectStore('Default Store View');
     \PHPUnit_Framework_Assert::assertEquals(self::ERROR_MESSAGE, $frontendCmsPage->getCmsPageContentBlock()->getPageHeadTitle(), 'Wrong page content is displayed.');
 }