Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCreditCardJsValidationMessagesArePresent.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutOnepage;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertCreditCardJsValidationMessagesArePresent extends AbstractConstraint
16 {
24  public function processAssert(CheckoutOnepage $checkoutOnepage, array $expectedErrorMessages)
25  {
26  $errorMessages = $checkoutOnepage->getBraintreeBlock()->getVisibleMessages($expectedErrorMessages);
27 
28  foreach (array_keys($errorMessages) as $field) {
29  \PHPUnit\Framework\Assert::assertEquals(
30  $expectedErrorMessages[$field],
31  $errorMessages[$field],
32  "Wrong js validation error message is displayed for field: $field."
33  );
34  }
35  }
36 
42  public function toString()
43  {
44  return 'Js validation error messages are correct for required fields.';
45  }
46 }