Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCmsPagesOnFrontendMultipleStoreViews.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Cms\Test\Page\CmsPage as FrontCmsPage;
10 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Client\BrowserInterface;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
17 class AssertCmsPagesOnFrontendMultipleStoreViews extends AbstractConstraint
18 {
29  public function processAssert(
30  array $cmsPages,
31  FrontCmsPage $frontCmsPage,
32  CmsIndex $cmsIndex,
33  BrowserInterface $browser,
34  $displayContent = null
35  ) {
36  foreach ($cmsPages as $cmsPage) {
37  $browser->open($_ENV['app_frontend_url'] . $cmsPage->getIdentifier());
38  $storeName = $cmsPage->getDataFieldConfig('store_id')['source']->getStore()->getData()['name'];
39  $cmsIndex->getStoreSwitcherBlock()->selectStoreView($storeName);
40  \PHPUnit\Framework\Assert::assertContains(
41  $displayContent != null ? $displayContent : $cmsPage->getContent()['content'],
42  $frontCmsPage->getCmsPageBlock()->getPageContent(),
43  'Wrong content page ' . $cmsPage->getTitle() . ' is displayed on store ' . $storeName . '.'
44  );
45  }
46  }
47 
53  public function toString()
54  {
55  return 'Created CMS Page displayed on store view with expected content.';
56  }
57 }
processAssert(array $cmsPages, FrontCmsPage $frontCmsPage, CmsIndex $cmsIndex, BrowserInterface $browser, $displayContent=null)
$storeName
Definition: logo.phtml:13