/** * Assert that shipped items quantity in 'Total Quantity' is equal to data from fixture on My Account page * * @param OrderHistory $orderHistory * @param OrderInjectable $order * @param CustomerOrderView $customerOrderView * @param ShipmentView $shipmentView * @param array $ids * @return void */ public function processAssert(OrderHistory $orderHistory, OrderInjectable $order, CustomerOrderView $customerOrderView, ShipmentView $shipmentView, array $ids) { $totalQty = $order->getTotalQtyOrdered(); $this->loginCustomerAndOpenOrderPage($order->getDataFieldConfig('customer_id')['source']->getCustomer()); $orderHistory->getOrderHistoryBlock()->openOrderById($order->getId()); $customerOrderView->getOrderViewBlock()->openLinkByName('Order Shipments'); foreach ($ids['shipmentIds'] as $key => $shipmentIds) { \PHPUnit_Framework_Assert::assertEquals($totalQty[$key], $shipmentView->getShipmentBlock()->getItemShipmentBlock($shipmentIds)->getTotalQty()); } }
/** * Assert shipment with corresponding shipment/order ID is present in 'Shipments' with correct total qty field * * @param ShipmentIndex $shipmentIndex * @param OrderInjectable $order * @param array $ids * @return void */ public function processAssert(ShipmentIndex $shipmentIndex, OrderInjectable $order, array $ids) { $shipmentIndex->open(); $orderId = $order->getId(); $totalQty = $order->getTotalQtyOrdered(); foreach ($ids['shipmentIds'] as $key => $shipmentIds) { $filter = ['id' => $shipmentIds, 'order_id' => $orderId, 'total_qty_from' => $totalQty[$key], 'total_qty_to' => $totalQty[$key]]; \PHPUnit_Framework_Assert::assertTrue($shipmentIndex->getShipmentsGrid()->isRowVisible($filter), 'Shipment is absent in shipment grid on shipment index page.'); } }
/** * Assert that shipment is present in the Shipments tab with correct shipped items quantity * * @param SalesOrderView $salesOrderView * @param OrderIndex $orderIndex * @param OrderInjectable $order * @param array $ids * @return void */ public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, OrderInjectable $order, array $ids) { $orderIndex->open(); $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); $salesOrderView->getOrderForm()->openTab('shipments'); $totalQty = $order->getTotalQtyOrdered(); $totalQty = is_array($totalQty) ? $totalQty : [$totalQty]; foreach ($ids['shipmentIds'] as $key => $shipmentId) { $filter = ['id' => $shipmentId, 'qty_from' => $totalQty[$key], 'qty_to' => $totalQty[$key]]; \PHPUnit_Framework_Assert::assertTrue($salesOrderView->getOrderForm()->getTabElement('shipments')->getGridBlock()->isRowVisible($filter), 'Shipment is absent on shipments tab.'); } }