Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCustomerNameFrontend.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Customer\Test\Page\CustomerAccountIndex;
10 use Magento\Customer\Test\Page\CustomerAccountEdit;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
17 class AssertCustomerNameFrontend extends AbstractConstraint
18 {
27  public function processAssert(
28  CustomerAccountIndex $customerAccountIndex,
29  CustomerAccountEdit $customerAccountEdit,
30  Customer $customer
31  ) {
32  $customerName = $customer->getFirstname() . " " . $customer->getLastname();
33 
34  $customerAccountIndex->open();
35  $infoBlock = $customerAccountIndex->getInfoBlock()->getContactInfoContent();
36  $infoBlock = explode(PHP_EOL, $infoBlock);
37  $nameInDashboard = $infoBlock[0];
38  \PHPUnit\Framework\Assert::assertTrue(
39  $nameInDashboard == $customerName,
40  'Customer name in Contact info block is not matching the fixture.'
41  );
42 
43  $customerAccountIndex->getInfoBlock()->openEditContactInfo();
44  $nameInEdit = $customerAccountEdit->getAccountInfoForm()->getFirstName()
45  . " " . $customerAccountEdit->getAccountInfoForm()->getLastName();
46  \PHPUnit\Framework\Assert::assertTrue(
47  $nameInEdit == $customerName,
48  'Customer name on Account info tab is not matching the fixture.'
49  );
50  }
51 
57  public function toString()
58  {
59  return 'Customer name in Contact information block and Account info is correct.';
60  }
61 }
$customer
Definition: customers.php:11
processAssert(CustomerAccountIndex $customerAccountIndex, CustomerAccountEdit $customerAccountEdit, Customer $customer)