Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCartPriceRuleConditionIsNotApplied.php
Go to the documentation of this file.
1 <?php
8 
13 {
19  protected function assert()
20  {
21  $subTotal = $this->checkoutCart->getTotalsBlock()->getSubtotal();
22  $grandTotal = $this->checkoutCart->getTotalsBlock()->getGrandTotal();
23 
24  if ($this->checkoutCart->getTotalsBlock()->isVisibleShippingPriceBlock()) {
25  $shippingPrice = $this->checkoutCart->getTotalsBlock()->getShippingPrice();
26  $grandTotal = number_format(($grandTotal - $shippingPrice), 2);
27  }
28  \PHPUnit\Framework\Assert::assertEquals(
29  $subTotal,
30  $grandTotal,
31  'Shopping cart subtotal: \'' . $subTotal . '\' not equals with grand total: \'' . $grandTotal . '\''
32  );
33  }
34 
40  public function toString()
41  {
42  return "Shopping cart subtotal equals to grand total - price rule has not been applied.";
43  }
44 }
$shippingPrice
Definition: price.phtml:12