/** * @construct * @param ObjectManager $objectManager * @param SalesOrderIndex $orderIndex * @param SalesOrderView $salesOrderView * @param Order|null $order * @param string|null $orderId * @param array|null $data * @param array|null $products * @param array|null $action */ public function __construct(ObjectManager $objectManager, SalesOrderIndex $orderIndex, SalesOrderView $salesOrderView, Order $order = null, $orderId = null, $data = null, $products = null, array $action = null) { $this->objectManager = $objectManager; $this->orderIndex = $orderIndex; $this->salesOrderView = $salesOrderView; $this->orderSalesEntityNew = $this->getSalesEntityNewPage(); $this->order = $order; $this->data = $data; $this->action = $action; $this->orderId = $orderId == null ? $this->order->getId() : $orderId; $this->products = $products == null ? $this->order->getEntityId()['products'] : $products; }
/** * Get assigned products. * * @param Order $order * @return array */ protected function getAssignedProducts(Order $order) { return $order->getEntityId()['products']; }
/** * Cancel created order. * * @param Order $order * @return array */ public function test(Order $order) { // Preconditions $order->persist(); // Steps $this->orderIndex->open(); $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); $this->salesOrderView->getPageActions()->cancel(); return ['customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), 'orderId' => $order->getId(), 'product' => $order->getEntityId()['products'][0]]; }
/** * Set fields for assert. * * @param Order|null $order * @param string|null $orderId * @param array|null $products * @param array|null $verifyData */ protected function setFields(Order $order = null, $orderId = null, array $products = null, array $verifyData = null) { $this->orderId = $orderId == null ? $order->getId() : $orderId; $this->products = $products == null ? $order->getEntityId()['products'] : $products; $this->verifyData = $verifyData; $this->productHandlerClass = $this->getProductHandlerClass(); }