Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductCompareRemoveLastProductMessage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductCompare;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
16 class AssertProductCompareRemoveLastProductMessage extends AbstractConstraint
17 {
18  const SUCCESS_MESSAGE = 'You have no items to compare.';
19 
26  public function processAssert(CatalogProductCompare $comparePage)
27  {
28  $comparePage->open();
29  $actualMessage = $comparePage->getCompareProductsBlock()->getEmptyMessage();
30  \PHPUnit\Framework\Assert::assertEquals(
31  self::SUCCESS_MESSAGE,
32  $actualMessage,
33  'Wrong success message is displayed.'
34  . "\nExpected: " . self::SUCCESS_MESSAGE
35  . "\nActual: " . $actualMessage
36  );
37  }
38 
44  public function toString()
45  {
46  return 'After removing last product the message appears on "Compare Products" page.';
47  }
48 }