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