Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCustomerDoesNotHaveDefaultAddresses.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Customer\Test\Page\CustomerAccountIndex;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertCustomerDoesNotHaveDefaultAddresses extends AbstractConstraint
16 {
23  public function processAssert(CustomerAccountIndex $customerAccountIndex)
24  {
25  $customerAccountIndex->open();
26  $defaultBillingAddress = explode(
27  "\n",
28  $customerAccountIndex->getDashboardAddress()->getDefaultBillingAddressText()
29  );
30  $defaultShippingAddress = explode(
31  "\n",
32  $customerAccountIndex->getDashboardAddress()->getDefaultShippingAddressText()
33  );
34  $actualAddressesTextValues = [
35  'defaultBillingAddress' => $defaultBillingAddress,
36  'defaultShippingAddress' => $defaultShippingAddress
37  ];
38  $expectedAddressesTextValues = [
39  'defaultBillingAddress' => [
40  'Default Billing Address',
41  'You have not set a default billing address.',
42  'Edit Address',
43  ],
44  'defaultShippingAddress' => [
45  'Default Shipping Address',
46  'You have not set a default shipping address.',
47  'Edit Address',
48  ]
49  ];
50 
51  \PHPUnit\Framework\Assert::assertEquals(
52  $expectedAddressesTextValues,
53  $actualAddressesTextValues,
54  'Customer has default shipping/billing address but should not.'
55  );
56  }
57 
63  public function toString()
64  {
65  return 'Customer does not have default shipping/billing address.';
66  }
67 }