Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertMsrpOnCategoryPage.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 use Magento\Mtf\Fixture\InjectableFixture;
13 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
14 
18 class AssertMsrpOnCategoryPage extends AbstractConstraint
19 {
28  public function processAssert(
29  CmsIndex $cmsIndex,
30  CatalogCategoryView $catalogCategoryView,
31  InjectableFixture $product
32  ) {
34  $cmsIndex->open();
35  $cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
36 
37  $productBlock = $catalogCategoryView->getMsrpListProductBlock()->getProductItem($product);
38  \PHPUnit\Framework\Assert::assertTrue(
39  $productBlock->isVisible(),
40  'Product is invisible on Category page.'
41  );
42 
43  $priceBlock = $productBlock->getPriceBlock();
44  \PHPUnit\Framework\Assert::assertEquals(
45  $product->getMsrp(),
46  $priceBlock->getOldPrice(),
47  'Displayed on Category page MSRP is incorrect.'
48  );
49  \PHPUnit\Framework\Assert::assertFalse(
50  $priceBlock->isRegularPriceVisible(),
51  'Regular price on Category page is visible and not expected.'
52  );
53  }
54 
60  public function toString()
61  {
62  return "Displayed Product MSRP data on category page is correct.";
63  }
64 }