Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductNameOnDifferentStoreViews.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductView;
10 use Magento\Mtf\Client\BrowserInterface;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 use Magento\Mtf\Fixture\FixtureInterface;
13 use Magento\Cms\Test\Page\CmsIndex;
14 
18 class AssertProductNameOnDifferentStoreViews extends AbstractConstraint
19 {
31  public function processAssert(
32  CatalogProductView $catalogProductView,
33  CmsIndex $cmsIndex,
34  BrowserInterface $browser,
35  FixtureInterface $initialProduct,
36  array $stores,
37  array $productNames
38  ) {
39  $browser->open($_ENV['app_frontend_url'] . $initialProduct->getUrlKey() . '.html');
40  foreach ($stores as $store) {
41  $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
42  $cmsIndex->getLinksBlock()->waitWelcomeMessage();
43  \PHPUnit\Framework\Assert::assertEquals(
44  $productNames[$store->getStoreId()],
45  $catalogProductView->getViewBlock()->getProductName(),
46  sprintf('Wrong product name is displayed for %s store view.', $store->getName())
47  );
48  }
49  }
50 
56  public function toString()
57  {
58  return 'Product name is correct on the storefront';
59  }
60 }
processAssert(CatalogProductView $catalogProductView, CmsIndex $cmsIndex, BrowserInterface $browser, FixtureInterface $initialProduct, array $stores, array $productNames)