Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FillShippingAddressesStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\FixtureFactory;
10 use Magento\Mtf\TestStep\TestStepInterface;
11 use Magento\Customer\Test\Fixture\Address;
12 use Magento\Checkout\Test\Page\CheckoutOnepage;
14 
18 class FillShippingAddressesStep implements TestStepInterface
19 {
25  private $checkoutOnepage;
26 
32  private $shippingAddresses;
33 
39  private $assertRate;
40 
44  private $isShippingAvailable;
45 
51  private $shippingMethod;
52 
62  public function __construct(
63  CheckoutOnepage $checkoutOnepage,
64  FixtureFactory $fixtureFactory,
66  array $shippingMethod,
67  array $shippingAddresses,
68  array $clearShippingAddress,
69  array $isShippingAvailable
70  ) {
71  $this->checkoutOnepage = $checkoutOnepage;
72  $this->assertRate = $assertRate;
73 
74  foreach ($shippingAddresses as $address) {
75  $data = array_merge($clearShippingAddress, $address);
76  $this->shippingAddresses[] = $fixtureFactory->createByCode('address', ['data' => $data]);
77  }
78  $this->isShippingAvailable = $isShippingAvailable;
79  $this->shippingMethod = $shippingMethod;
80  }
81 
87  public function run()
88  {
89  foreach ($this->shippingAddresses as $key => $shippingAddress) {
90  $this->checkoutOnepage->getShippingBlock()->fill($shippingAddress);
91  $this->assertRate->processAssert(
92  $this->checkoutOnepage,
93  $this->shippingMethod,
94  $this->isShippingAvailable[$key]
95  );
96  }
97  }
98 }
$shippingAddress
Definition: order.php:40
$address
Definition: customer.php:38
__construct(CheckoutOnepage $checkoutOnepage, FixtureFactory $fixtureFactory, AssertCityBasedShippingRateChanged $assertRate, array $shippingMethod, array $shippingAddresses, array $clearShippingAddress, array $isShippingAvailable)
$shippingMethod
Definition: popup.phtml:12