Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertDateInvalidErrorMessage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertDateInvalidErrorMessage extends AbstractConstraint
16 {
20  const INVALID_DATE_ERROR_MESSAGE = 'Make sure the To Date is later than or the same as the From Date.';
21 
28  public function processAssert(CatalogProductEdit $productPage)
29  {
30  $actualMessages = $productPage->getMessagesBlock()->getErrorMessage();
31  \PHPUnit\Framework\Assert::assertContains(
32  self::INVALID_DATE_ERROR_MESSAGE,
33  $actualMessages,
34  'Wrong error message is displayed.'
35  . "\nExpected: " . self::INVALID_DATE_ERROR_MESSAGE
36  . "\nActual:\n" . $actualMessages
37  );
38  }
39 
45  public function toString()
46  {
47  return 'Invalid date range error message is displayed.';
48  }
49 }