Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertAddressDeletedBackend.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Customer\Test\Fixture\Address;
11 use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex;
12 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 
19 class AssertAddressDeletedBackend extends AbstractConstraint
20 {
30  public function processAssert(
31  OrderIndex $orderIndex,
32  OrderCreateIndex $orderCreateIndex,
33  Address $deletedAddress,
34  Customer $customer
35  ) {
36  $filter = ['email' => $customer->getEmail()];
37  $orderIndex->open()->getGridPageActions()->addNew();
38  $orderCreateIndex->getCustomerBlock()->searchAndOpen($filter);
39  $orderCreateIndex->getStoreBlock()->selectStoreView();
40  $actualAddresses = $orderCreateIndex->getCreateBlock()->getBillingAddressBlock()->getExistingAddresses();
41  $addressRenderer = $this->objectManager->create(
42  \Magento\Customer\Test\Block\Address\Renderer::class,
43  ['address' => $deletedAddress]
44  );
45  $addressToSearch = $addressRenderer->render();
46  \PHPUnit\Framework\Assert::assertFalse(
47  in_array($addressToSearch, $actualAddresses),
48  'Deleted address is present on backend during order creation'
49  );
50  }
51 
57  public function toString()
58  {
59  return 'Deleted address is absent on backend during order creation';
60  }
61 }
$customer
Definition: customers.php:11
processAssert(OrderIndex $orderIndex, OrderCreateIndex $orderCreateIndex, Address $deletedAddress, Customer $customer)