Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCustomerBackendRequiredFields.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Customer\Test\Page\Adminhtml\CustomerIndexNew;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertCustomerBackendRequiredFields extends AbstractConstraint
16 {
20  const REQUIRE_MESSAGE = 'This is a required field.';
21 
29  public function processAssert(CustomerIndexNew $customerNewPage, array $expectedRequiredFields)
30  {
31  $actualRequiredFields = $customerNewPage->getCustomerForm()->getJsErrors();
32  foreach ($expectedRequiredFields as $field) {
33  \PHPUnit\Framework\Assert::assertTrue(
34  isset($actualRequiredFields[$field]),
35  "Field '$field' is not highlighted with an JS error."
36  );
37  \PHPUnit\Framework\Assert::assertEquals(
38  self::REQUIRE_MESSAGE,
39  $actualRequiredFields[$field],
40  "Field '$field' is not highlighted as required."
41  );
42  }
43  }
44 
50  public function toString()
51  {
52  return 'All required fields on customer form are highlighted.';
53  }
54 }
processAssert(CustomerIndexNew $customerNewPage, array $expectedRequiredFields)