Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductReviewIsAbsentOnProductPage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
10 use Magento\Catalog\Test\Page\Product\CatalogProductView;
11 
15 class AssertProductReviewIsAbsentOnProductPage extends AbstractConstraint
16 {
22  protected $severeness = 'middle';
23 
27  const NO_REVIEW_LINK_TEXT = 'Be the first to review this product';
28 
35  public function processAssert(CatalogProductView $catalogProductView)
36  {
37  $catalogProductView->getViewBlock()->selectTab('Reviews');
38 
39  \PHPUnit\Framework\Assert::assertFalse(
40  $catalogProductView->getCustomerReviewBlock()->isVisibleReviewItem(),
41  'No reviews below the form required.'
42  );
43 
44  \PHPUnit\Framework\Assert::assertEquals(
45  self::NO_REVIEW_LINK_TEXT,
46  trim($catalogProductView->getReviewSummary()->getAddReviewLink()->getText()),
47  sprintf('"%s" link is not available', self::NO_REVIEW_LINK_TEXT)
48  );
49  }
50 
56  public function toString()
57  {
58  return 'Product do not have a review on product page.';
59  }
60 }