Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertDiscountInShoppingCart.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 
18 class AssertDiscountInShoppingCart extends AbstractConstraint
19 {
27  public function processAssert(CheckoutCart $checkoutCart, Cart $cart)
28  {
29  $checkoutCart->open();
30  $checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
31  \PHPUnit\Framework\Assert::assertEquals(
32  number_format($cart->getDiscount(), 2),
33  $checkoutCart->getTotalsBlock()->getDiscount(),
34  'Discount amount in the shopping cart not equals to discount amount from fixture.'
35  );
36  }
37 
43  public function toString()
44  {
45  return 'Discount in the shopping cart equals to expected discount amount from data set.';
46  }
47 }