Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SubmitOrderWithoutAdditionalInfoStep.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 SubmitOrderWithoutAdditionalInfoStep 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 
71  public function __construct(
72  OrderCreateIndex $orderCreateIndex,
73  SalesOrderView $salesOrderView,
74  FixtureFactory $fixtureFactory,
75  Customer $customer,
76  array $products,
77  Address $billingAddress = null
78  ) {
79  $this->orderCreateIndex = $orderCreateIndex;
80  $this->salesOrderView = $salesOrderView;
81  $this->fixtureFactory = $fixtureFactory;
82  $this->customer = $customer;
83  $this->billingAddress = $billingAddress;
84  $this->products = $products;
85  }
86 
92  public function run()
93  {
94  $this->orderCreateIndex->getCreateBlock()->submitOrder();
95  $this->salesOrderView->getMessagesBlock()->waitSuccessMessage();
96  $orderId = trim($this->salesOrderView->getTitleBlock()->getTitle(), '#');
97  $order = $this->fixtureFactory->createByCode(
98  'orderInjectable',
99  [
100  'data' => [
101  'id' => $orderId,
102  'customer_id' => ['customer' => $this->customer],
103  'entity_id' => ['products' => $this->products],
104  'billing_address_id' => ['billingAddress' => $this->billingAddress],
105  ]
106  ]
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)