/** * Get cart prices. * * @param CatalogProductSimple $product * @param array $actualPrices * @return array */ protected function getCartPrice(CatalogProductSimple $product, array $actualPrices) { $actualPrices['cart_item_price_incl_tax'] = $this->checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('cart_item_price_incl_tax'); $actualPrices['cart_item_subtotal_incl_tax'] = $this->checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('cart_item_subtotal_incl_tax'); $actualPrices['grand_total'] = $this->checkoutCart->getTotalsBlock()->getData('grand_total_incl_tax'); return $actualPrices; }
/** * Assert that grand total is equal to expected. * * @param CheckoutCart $checkoutCart * @param Cart $cart * @param Customer|null $customer * @return void */ public function processAssert(CheckoutCart $checkoutCart, Cart $cart, Customer $customer = null) { if ($customer !== null) { $this->login($customer); } $checkoutCart->open(); \PHPUnit_Framework_Assert::assertEquals(number_format($cart->getGrandTotal(), 2), $checkoutCart->getTotalsBlock()->getData('grand_total')); }
/** * Get grand total. * * @return array */ protected function getTotalPrice() { $prices = []; foreach ($this->expectedPrices['total'] as $key => $type) { $prices[$key] = $this->checkoutCart->getTotalsBlock()->getData($key); } return $prices; }
/** * Get totals from total block in shopping cart. * * @return array */ protected function getTotals() { $totals = []; $totals['subtotal'] = $this->checkoutCart->getTotalsBlock()->getData('subtotal'); $totals['grandTotal'] = $this->checkoutCart->getTotalsBlock()->getData('grand_total'); if ($this->checkoutCart->getTotalsBlock()->isVisibleShippingPriceBlock()) { $shippingPrice = $this->checkoutCart->getTotalsBlock()->getData('shipping_price'); $totals['grandTotal'] = number_format($totals['grandTotal'] - $shippingPrice, 2); } return $totals; }
/** * Assert that grand total is equal to expected. * * @param CheckoutCart $checkoutCart * @param Cart $cart * @return void */ public function processAssert(CheckoutCart $checkoutCart, Cart $cart) { $checkoutCart->open(); \PHPUnit_Framework_Assert::assertEquals(number_format($cart->getGrandTotal(), 2), $checkoutCart->getTotalsBlock()->getData('grand_total')); }
/** * Get totals. * * @return array */ protected function getTotals() { $totalsBlock = $this->checkoutCart->getTotalsBlock(); return $this->getTypeBlockData($totalsBlock); }