Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertShippingInShoppingCart.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 
16 class AssertShippingInShoppingCart extends AbstractConstraint
17 {
18  /* tags */
19  const SEVERITY = 'low';
20  /* end tags */
21 
30  public function processAssert(CheckoutCart $checkoutCart, Cart $cart, $requireReload = true)
31  {
32  if ($requireReload) {
33  $checkoutCart->open();
34  }
35 
36  $fixtureShippingAmount = number_format((float)$cart->getShippingAmount(), 2);
37  $pageShippingAmount = $checkoutCart->getTotalsBlock()->getShippingPrice();
38  \PHPUnit\Framework\Assert::assertEquals(
39  $fixtureShippingAmount,
40  $pageShippingAmount,
41  'Shipping amount in the shopping cart not equals to shipping amount from fixture.'
42  );
43  }
44 
50  public function toString()
51  {
52  return 'Shipping amount in the shopping cart equals to expected shipping amount from data set.';
53  }
54 }
processAssert(CheckoutCart $checkoutCart, Cart $cart, $requireReload=true)