Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteCustomerAddressTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Customer\Test\Page\CustomerAccountIndex;
11 use Magento\Mtf\TestCase\Injectable;
12 
29 class DeleteCustomerAddressTest extends Injectable
30 {
31  /* tags */
32  const MVP = 'yes';
33  const STABLE = 'no';
34  /* end tags */
35 
42 
49  public function __inject(
50  CustomerAccountIndex $customerAccountIndex
51  ) {
52  $this->customerAccountIndex = $customerAccountIndex;
53  }
54 
61  public function test(Customer $customer)
62  {
63  // Precondition:
64  $customer->persist();
65  $addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[1];
66 
67  // Steps:
68  $this->objectManager->create(
69  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
70  ['customer' => $customer]
71  )->run();
72  $this->customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book');
73  $this->customerAccountIndex->getAdditionalAddressBlock()->deleteAdditionalAddress($addressToDelete);
74 
75  return ['deletedAddress' => $addressToDelete];
76  }
77 }
$customer
Definition: customers.php:11