/** * Assert that invoiced Grand Total amount is equal to placed order Grand total amount on invoice page (frontend) * * @param OrderHistory $orderHistory * @param OrderInjectable $order * @param CustomerOrderView $customerOrderView * @param InvoiceView $invoiceView * @param array $ids * @return void */ public function processAssert(OrderHistory $orderHistory, OrderInjectable $order, CustomerOrderView $customerOrderView, InvoiceView $invoiceView, array $ids) { $this->loginCustomerAndOpenOrderPage($order->getDataFieldConfig('customer_id')['source']->getCustomer()); $orderHistory->getOrderHistoryBlock()->openOrderById($order->getId()); $customerOrderView->getOrderViewBlock()->openLinkByName('Invoices'); foreach ($ids['invoiceIds'] as $key => $invoiceId) { \PHPUnit_Framework_Assert::assertEquals(number_format($order->getPrice()[$key]['grand_invoice_total'], 2), $invoiceView->getInvoiceBlock()->getItemBlock($invoiceId)->getGrandTotal()); } }
/** * Get order product prices. * * @param InjectableFixture $product * @param $actualPrices * @return array */ public function getOrderPrices($actualPrices, InjectableFixture $product) { $viewBlock = $this->customerOrderView->getOrderViewBlock(); $actualPrices['cart_item_price_excl_tax'] = $viewBlock->getItemPriceExclTax($product->getName()); $actualPrices['cart_item_price_incl_tax'] = $viewBlock->getItemPriceInclTax($product->getName()); $actualPrices['cart_item_subtotal_excl_tax'] = $viewBlock->getItemSubExclTax($product->getName()); $actualPrices['cart_item_subtotal_incl_tax'] = $viewBlock->getItemSubInclTax($product->getName()); return $actualPrices; }
/** * 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()); } }