Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductPriceOnDifferentStoreViews.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 AssertProductPriceOnDifferentStoreViews extends AbstractConstraint
19 {
30  public function processAssert(
31  CatalogProductView $catalogProductView,
32  CmsIndex $cmsIndex,
33  BrowserInterface $browser,
34  FixtureInterface $initialProduct,
35  array $stores
36  ) {
37  $browser->open($_ENV['app_frontend_url'] . $initialProduct->getUrlKey() . '.html');
38  foreach ($stores as $store) {
39  $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName());
40  $cmsIndex->getLinksBlock()->waitWelcomeMessage();
41  \PHPUnit\Framework\Assert::assertEquals(
42  '9.99',
43  $catalogProductView->getViewBlock()->getPriceBlock()->getPrice(),
44  sprintf('Wrong product price is displayed for %s store view.', $store->getName())
45  );
46  }
47  }
48 
54  public function toString()
55  {
56  return 'Product name is correct on the storefront';
57  }
58 }
processAssert(CatalogProductView $catalogProductView, CmsIndex $cmsIndex, BrowserInterface $browser, FixtureInterface $initialProduct, array $stores)