Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertIntegrationNameDuplicationErrorMessage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Integration\Test\Fixture\Integration;
10 use Magento\Integration\Test\Page\Adminhtml\IntegrationIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertIntegrationNameDuplicationErrorMessage extends AbstractConstraint
17 {
18  const ERROR_DUPLICATE_INTEGRATION_NAME = 'The integration with name "%s" exists.';
19 
27  public function processAssert(
28  IntegrationIndex $integrationIndexPage,
29  Integration $integration
30  ) {
31  $expectedMessage = sprintf(self::ERROR_DUPLICATE_INTEGRATION_NAME, $integration->getName());
32  $actualMessage = $integrationIndexPage->getMessagesBlock()->getErrorMessage();
33  \PHPUnit\Framework\Assert::assertEquals(
34  $expectedMessage,
35  $actualMessage,
36  'Wrong error message is displayed.'
37  . "\nExpected: " . $expectedMessage
38  . "\nActual: " . $actualMessage
39  );
40  }
41 
47  public function toString()
48  {
49  return 'Duplicated integration name error message is correct.';
50  }
51 }