Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PlaceOrderWithPaymentsAdvancedStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutOnepage;
10 use Magento\Mtf\Fixture\FixtureFactory;
11 use Magento\Mtf\TestStep\TestStepInterface;
12 use Magento\Payment\Test\Fixture\CreditCard;
14 
18 class PlaceOrderWithPaymentsAdvancedStep implements TestStepInterface
19 {
25  private $checkoutOnepage;
26 
32  private $fixtureFactory;
33 
39  private $products;
40 
46  private $payment;
47 
53  private $creditCard;
54 
62  public function __construct(
63  CheckoutOnepage $checkoutOnepage,
64  FixtureFactory $fixtureFactory,
65  CreditCard $creditCard,
66  array $payment,
67  array $products
68  ) {
69  $this->checkoutOnepage = $checkoutOnepage;
70  $this->fixtureFactory = $fixtureFactory;
71  $this->creditCard = $creditCard;
72  $this->payment = $payment;
73  $this->products = $products;
74  }
75 
81  public function run()
82  {
83  $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment);
84  $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
85  $this->checkoutOnepage->getPaymentsAdvancedBlock()->fillPaymentData($this->creditCard);
86 
88  $order = $this->fixtureFactory->createByCode(
89  'orderInjectable',
90  [
91  'data' => [
92  'entity_id' => ['products' => $this->products]
93  ]
94  ]
95  );
96  return ['order' => $order];
97  }
98 }
$order
Definition: order.php:55
$payment
Definition: order.php:17
__construct(CheckoutOnepage $checkoutOnepage, FixtureFactory $fixtureFactory, CreditCard $creditCard, array $payment, array $products)