24 $taxRate = $this->taxRule->getDataFieldConfig(
'tax_rate')[
'source']->getFixture()[0]->getRate();
25 $expectedGrandTotal = $this->productSimple->getPrice() +
$taxRate + $this->shipping[
'price'];
26 $expectedGrandTotal = number_format($expectedGrandTotal, 2);
27 $actualGrandTotal = $this->checkoutCart->getTotalsBlock()->getGrandTotal();
29 if ($this->checkoutCart->getTotalsBlock()->isTaxVisible()) {
30 $expectedTax = number_format(
$taxRate, 2);
31 $actualTax = $this->checkoutCart->getTotalsBlock()->getTax();
32 if ($expectedTax !== $actualTax) {
33 $errorMessages[] =
'Tax Rule \'' . $this->taxRuleCode .
'\' is applied wrong.
' 34 . "\nExpected: " . $expectedTax 35 . "\nActual: " . $actualTax; 39 if ($expectedGrandTotal !== $actualGrandTotal) { 40 $errorMessages[] = 'Grand Total is not correct.
' 41 . "\nExpected: " . $expectedGrandTotal 42 . "\nActual: " . $actualGrandTotal; 45 \PHPUnit\Framework\Assert::assertTrue(empty($errorMessages), implode(";\n", $errorMessages)); 53 public function toString() 55 return "Tax rule applied on product in shopping cart.";