Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertGrandTotalInShoppingCart.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Checkout\Test\Page\CheckoutCart;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
17 class AssertGrandTotalInShoppingCart extends AbstractConstraint
18 {
27  public function processAssert(CheckoutCart $checkoutCart, Cart $cart, $requireReload = true)
28  {
29  if ($requireReload) {
30  $checkoutCart->open();
31  $checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
32  }
33 
34  $fixtureGrandTotal = number_format($cart->getGrandTotal(), 2);
35  $pageGrandTotal = $checkoutCart->getTotalsBlock()->getGrandTotal();
36  \PHPUnit\Framework\Assert::assertEquals(
37  $fixtureGrandTotal,
38  $pageGrandTotal,
39  'Grand total price in the shopping cart not equals to grand total price from fixture.'
40  );
41  }
42 
48  public function toString()
49  {
50  return 'Grand total price in the shopping cart equals to expected grand total price from data set.';
51  }
52 }
processAssert(CheckoutCart $checkoutCart, Cart $cart, $requireReload=true)