Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddNewShippingAddressStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutOnepage;
10 use Magento\Customer\Test\Fixture\Address;
11 use Magento\Mtf\TestStep\TestStepInterface;
12 
16 class AddNewShippingAddressStep implements TestStepInterface
17 {
23  private $checkoutOnepage;
24 
30  private $address;
31 
37  private $save;
38 
45  public function __construct(CheckoutOnepage $checkoutOnepage, Address $shippingAddress = null, $save = true)
46  {
47  $this->checkoutOnepage = $checkoutOnepage;
48  $this->address = $shippingAddress;
49  $this->save = $save;
50  }
51 
57  public function run()
58  {
59  $shippingBlock = $this->checkoutOnepage->getShippingBlock();
60  $shippingBlock->clickOnNewAddressButton();
61  if ($this->address) {
62  $shippingBlock->getAddressModalBlock()->fill($this->address);
63  }
64  if ($this->save) {
65  $shippingBlock->getAddressModalBlock()->save();
66  } else {
67  $shippingBlock->getAddressModalBlock()->cancel();
68  }
69 
70  return ['shippingAddress' => $this->address];
71  }
72 }
$shippingAddress
Definition: order.php:40
__construct(CheckoutOnepage $checkoutOnepage, Address $shippingAddress=null, $save=true)