Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertImportCheckDataErrorMessage.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\ImportExport\Test\Page\Adminhtml\AdminImportIndex;
9 use Magento\Mtf\Constraint\AbstractConstraint;
10 
14 class AssertImportCheckDataErrorMessage extends AbstractConstraint
15 {
19  const ERROR_MESSAGE = 'Data validation failed. Please fix the following errors and upload the file again.';
20 
27  public function processAssert(AdminImportIndex $adminImportIndex)
28  {
29  $actualMessage = $adminImportIndex->getMessagesBlock()->getErrorMessage();
30 
31  \PHPUnit\Framework\Assert::assertNotFalse($actualMessage, 'Error message is absent.');
32 
33  \PHPUnit\Framework\Assert::assertEquals(
34  static::ERROR_MESSAGE,
35  $actualMessage,
36  'Wrong error message is displayed.'
37  . "\nExpected: " . self::ERROR_MESSAGE
38  . "\nActual: " . $actualMessage
39  );
40  }
41 
47  public function toString()
48  {
49  return 'Data check error message is present.';
50  }
51 }