public function AdjustmentComparator::assertEquals in Commerce Core 8.2
File
- modules/
order/ src/ Comparator/ AdjustmentComparator.php, line 24
Class
- AdjustmentComparator
- Provides a PHPUnit comparator for adjustments.
Namespace
Drupal\commerce_order\ComparatorCode
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = FALSE, $ignoreCase = FALSE) {
assert($expected instanceof Adjustment);
assert($actual instanceof Adjustment);
$expected_array = $expected
->toArray();
$actual_array = $actual
->toArray();
unset($expected_array['amount'], $actual_array['amount']);
if (!$actual
->getAmount()
->equals($expected
->getAmount()) || $expected_array !== $actual_array) {
throw new ComparisonFailure($expected, $actual, var_export($expected, TRUE), var_export($actual, TRUE), FALSE, sprintf('Failed asserting that Adjustment "%s" matches expected "%s".', $actual
->getLabel(), $expected
->getLabel()));
}
}