本文整理汇总了PHP中Magento\Checkout\Test\Page\CheckoutCart::getTotalsBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckoutCart::getTotalsBlock方法的具体用法?PHP CheckoutCart::getTotalsBlock怎么用?PHP CheckoutCart::getTotalsBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Checkout\Test\Page\CheckoutCart
的用法示例。
在下文中一共展示了CheckoutCart::getTotalsBlock方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Apply coupon before one page checkout.
*
* @return void
*/
public function run()
{
if ($this->salesRule !== null) {
$this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->salesRule->getCouponCode());
$this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
}
}
示例2: run
/**
* Checkout with Braintree PayPal from Shopping Cart.
*
* @return void
*/
public function run()
{
$this->checkoutCart->open();
$this->checkoutCart->getTotalsBlock()->waitForShippingPriceBlock();
$this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
$currentWindow = $this->checkoutCart->getCartBlock()->braintreePaypalCheckout();
$this->checkoutCart->getBraintreePaypalBlock()->process($currentWindow);
}
示例3: processAssert
/**
* Assert that grand total is equal to expected
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @param boolean $requireReload
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart, $requireReload = true)
{
if ($requireReload) {
$checkoutCart->open();
$checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
}
$fixtureGrandTotal = number_format($cart->getGrandTotal(), 2);
$pageGrandTotal = $checkoutCart->getTotalsBlock()->getGrandTotal();
\PHPUnit_Framework_Assert::assertEquals($fixtureGrandTotal, $pageGrandTotal, 'Grand total price in the shopping cart not equals to grand total price from fixture.');
}
示例4: processAssert
/**
* Assert that shipping amount is equal to expected.
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart)
{
$checkoutCart->open();
$fixtureShippingAmount = number_format((double) $cart->getShippingAmount(), 2);
$pageShippingAmount = $checkoutCart->getTotalsBlock()->getShippingPrice();
\PHPUnit_Framework_Assert::assertEquals($fixtureShippingAmount, $pageShippingAmount, 'Shipping amount in the shopping cart not equals to shipping amount from fixture.');
}
示例5: getCartPrice
/**
* Get cart prices
*
* @param CatalogProductSimple $product
* @param array $actualPrices
* @return array
*/
protected function getCartPrice(CatalogProductSimple $product, $actualPrices)
{
$this->checkoutCart->open();
$actualPrices['cart_item_price_incl_tax'] = $this->checkoutCart->getCartBlock()->getCartItem($product)->getPriceInclTax();
$actualPrices['cart_item_subtotal_incl_tax'] = $this->checkoutCart->getCartBlock()->getCartItem($product)->getSubtotalPriceInclTax();
$actualPrices['grand_total'] = $this->checkoutCart->getTotalsBlock()->getGrandTotalIncludingTax();
return $actualPrices;
}
示例6: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param CheckoutCart $checkoutCartPage
* @param array $products
* @param array $cartPrice
* @param array $productPrice
* @param Customer $customer
* @return void
*/
public function processAssert(CheckoutCart $checkoutCartPage, array $products, array $cartPrice, array $productPrice, Customer $customer = null)
{
if ($customer !== null) {
$this->objectManager->create('\\Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
}
$this->objectManager->create('\\Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', ['products' => $products])->run();
$checkoutCartPage->open();
foreach ($products as $key => $product) {
$actualPrice = $checkoutCartPage->getCartBlock()->getCartItem($product)->getSubtotalPrice();
\PHPUnit_Framework_Assert::assertEquals($productPrice[$key]['sub_total'], $actualPrice, 'Wrong product price is displayed.' . "\nExpected: " . $productPrice[$key]['sub_total'] . "\nActual: " . $actualPrice . "\n");
}
$actualPrices['sub_total'] = $checkoutCartPage->getTotalsBlock()->getSubtotal();
$actualPrices['grand_total'] = $checkoutCartPage->getTotalsBlock()->getGrandTotal();
$expectedPrices['sub_total'] = $cartPrice['sub_total'];
$expectedPrices['grand_total'] = $cartPrice['grand_total'];
\PHPUnit_Framework_Assert::assertEquals($expectedPrices, $actualPrices, 'Wrong total cart prices are displayed.');
}
示例7: processAssert
/**
* Assert that tax amount is equal to expected.
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @param boolean $requireReload
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart, $requireReload = true)
{
if ($requireReload) {
$checkoutCart->open();
}
$fixtureTaxAmount = number_format((double) $cart->getTaxAmount(), 2);
$pageTaxAmount = $checkoutCart->getTotalsBlock()->getTax();
\PHPUnit_Framework_Assert::assertEquals($fixtureTaxAmount, $pageTaxAmount, 'Tax amount in the shopping cart not equals to tax amount from fixture.');
}
示例8: run
/**
* Estimate shipping and tax and process assertions for totals.
*
* @return void
*/
public function run()
{
$this->checkoutCart->open();
$this->checkoutCart->getCartBlock()->waitCartContainerLoading();
/** @var \Magento\Checkout\Test\Fixture\Cart $cart */
if ($this->cart !== null) {
$cart = $this->fixtureFactory->createByCode('cart', ['data' => array_merge($this->cart->getData(), ['items' => ['products' => $this->products]])]);
$this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($this->address);
if (!empty($this->shipping)) {
$this->checkoutCart->getShippingBlock()->selectShippingMethod($this->shipping);
}
$this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
$this->assertEstimateShippingAndTax->processAssert($this->checkoutCart, $cart, false);
}
}
示例9: getCartPrice
/**
* Get cart prices
*
* @param CatalogProductSimple $product
* @param array $actualPrices
* @return array
*/
protected function getCartPrice(CatalogProductSimple $product, array $actualPrices)
{
$this->checkoutCart->open();
$productItem = $this->checkoutCart->getCartBlock()->getCartItem($product);
$productWeeeItem = $this->checkoutCart->getWeeeCartBlock()->getCartItem($product);
$actualPrices['cart_item_price'] = $productItem->getPrice();
$actualPrices['cart_item_fpt'] = $productWeeeItem->getPriceFptBlock()->getFpt();
$actualPrices['cart_item_fpt_total'] = $productWeeeItem->getPriceFptBlock()->getFptTotal();
$actualPrices['cart_item_subtotal'] = $productItem->getSubtotalPrice();
$actualPrices['cart_item_subtotal_fpt'] = $productWeeeItem->getSubtotalFptBlock()->getFpt();
$actualPrices['cart_item_subtotal_fpt_total'] = $productWeeeItem->getSubtotalFptBlock()->getFptTotal();
$actualPrices['grand_total'] = $this->checkoutCart->getTotalsBlock()->getGrandTotal();
$actualPrices['total_fpt'] = $this->checkoutCart->getWeeeTotalsBlock()->getFptBlock()->getTotalFpt();
return $actualPrices;
}
示例10: processAssert
/**
* Assert that discount is equal to expected.
*
* @param CheckoutCart $checkoutCart
* @param Cart $cart
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, Cart $cart)
{
$checkoutCart->open();
$checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
\PHPUnit_Framework_Assert::assertEquals(number_format($cart->getDiscount(), 2), $checkoutCart->getTotalsBlock()->getDiscount(), 'Discount amount in the shopping cart not equals to discount amount from fixture.');
}