Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SubmitOrderWithVaultStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Customer\Test\Fixture\Address;
11 use Magento\Mtf\Fixture\FixtureFactory;
12 use Magento\Mtf\TestStep\TestStepInterface;
13 use Magento\Sales\Test\Page\Adminhtml\OrderCreateIndex;
14 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
15 
19 class SubmitOrderWithVaultStep implements TestStepInterface
20 {
26  private $orderCreateIndex;
27 
33  private $salesOrderView;
34 
40  private $fixtureFactory;
41 
47  private $customer;
48 
54  private $billingAddress;
55 
61  private $products;
62 
72  public function __construct(
73  OrderCreateIndex $orderCreateIndex,
74  SalesOrderView $salesOrderView,
75  FixtureFactory $fixtureFactory,
76  Customer $customer,
77  array $products,
78  Address $billingAddress = null
79  ) {
80  $this->orderCreateIndex = $orderCreateIndex;
81  $this->salesOrderView = $salesOrderView;
82  $this->fixtureFactory = $fixtureFactory;
83  $this->customer = $customer;
84  $this->billingAddress = $billingAddress;
85  $this->products = $products;
86  }
87 
93  public function run()
94  {
95  $this->orderCreateIndex->getCreateBlock()->submitOrder();
96  $this->salesOrderView->getMessagesBlock()->waitSuccessMessage();
97  $orderId = trim($this->salesOrderView->getTitleBlock()->getTitle(), '#');
98  $data = [
99  'id' => $orderId,
100  'customer_id' => ['customer' => $this->customer],
101  'entity_id' => ['products' => $this->products],
102  'billing_address_id' => ['billingAddress' => $this->billingAddress],
103  ];
104  $order = $this->fixtureFactory->createByCode(
105  'orderInjectable',
106  ['data' => $data]
107  );
108 
109  return ['orderId' => $orderId, 'order' => $order];
110  }
111 }
$customer
Definition: customers.php:11
$order
Definition: order.php:55
__construct(OrderCreateIndex $orderCreateIndex, SalesOrderView $salesOrderView, FixtureFactory $fixtureFactory, Customer $customer, array $products, Address $billingAddress=null)