Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PlaceOrderWithPayflowLinkStep.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Checkout\Test\Page\CheckoutOnepage;
9 use Magento\Mtf\Fixture\FixtureFactory;
10 use Magento\Mtf\TestStep\TestStepInterface;
11 use Magento\Payment\Test\Fixture\CreditCard;
13 
17 class PlaceOrderWithPayflowLinkStep implements TestStepInterface
18 {
24  private $checkoutOnepage;
25 
31  private $fixtureFactory;
32 
38  private $products;
39 
45  private $payment;
46 
52  private $creditCard;
53 
59  private $order;
60 
69  public function __construct(
70  CheckoutOnepage $checkoutOnepage,
71  FixtureFactory $fixtureFactory,
72  CreditCard $creditCard,
73  array $payment,
74  array $products,
75  OrderInjectable $order = null
76  ) {
77  $this->checkoutOnepage = $checkoutOnepage;
78  $this->fixtureFactory = $fixtureFactory;
79  $this->creditCard = $creditCard;
80  $this->payment = $payment;
81  $this->products = $products;
82  $this->order = $order;
83  }
84 
90  public function run()
91  {
92  $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment);
93  $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
94  $this->checkoutOnepage->getPayflowLinkBlock()->fillPaymentData($this->creditCard);
95 
96  $data = [];
97  if ($this->order !== null) {
98  $data = $this->order->getData();
99  }
100 
102  $order = $this->fixtureFactory->createByCode(
103  'orderInjectable',
104  [
105  'data' => array_replace_recursive(
106  $data,
107  ['entity_id' => ['products' => $this->products]]
108  )
109  ]
110  );
111 
112  return ['order' => $order];
113  }
114 }
$payment
Definition: order.php:17