Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCatalogPriceRuleNotAppliedCatalogPage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Cms\Test\Page\CmsIndex;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
12 
16 class AssertCatalogPriceRuleNotAppliedCatalogPage extends AbstractConstraint
17 {
26  public function processAssert(
27  CmsIndex $cmsIndexPage,
28  CatalogCategoryView $catalogCategoryViewPage,
29  array $products
30  ) {
31  $cmsIndexPage->open();
32  foreach ($products as $product) {
33  $categoryName = $product->getCategoryIds()[0];
34  $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName);
35  $priceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->getPriceBlock();
36  \PHPUnit\Framework\Assert::assertFalse(
37  $priceBlock->isSpecialPriceVisible(),
38  "Catalog price rule is applied!\n"
39  );
40  }
41  }
42 
48  public function toString()
49  {
50  return 'Catalog price rule was not applied to products on catalog page.';
51  }
52 }
processAssert(CmsIndex $cmsIndexPage, CatalogCategoryView $catalogCategoryViewPage, array $products)