Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertEmailValidationErrorGenerated.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Integration\Test\Page\Adminhtml\IntegrationNew;
10 use Magento\Integration\Test\Fixture\Integration;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertEmailValidationErrorGenerated extends AbstractConstraint
17 {
25  public function processAssert(
26  IntegrationNew $integrationNew,
27  Integration $integration
28  ) {
29  $errors = $integrationNew->getIntegrationForm()->getJsErrors("integration_info");
30  $emailJsError = false;
31  foreach ($errors as $error) {
32  if (strpos($error, 'Please enter a valid email address') !== false) {
33  $emailJsError = true;
34  break;
35  }
36  }
37  \PHPUnit\Framework\Assert::assertTrue(
38  $emailJsError,
39  'Failed to validate email address (' . $integration->getEmail() . ') when saving integration.'
40  );
41  }
42 
48  public function toString()
49  {
50  return 'Email address is properly validated when saving integration.';
51  }
52 }
$errors
Definition: overview.phtml:9