You are here

public function PriceComparator::assertEquals in Price 2.0.x

Same name and namespace in other branches
  1. 2.x src/Comparator/PriceComparator.php \Drupal\price\Comparator\PriceComparator::assertEquals()

File

src/Comparator/PriceComparator.php, line 24

Class

PriceComparator
Provides a PHPUnit comparator for prices.

Namespace

Drupal\price\Comparator

Code

public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = FALSE, $ignoreCase = FALSE) {
  assert($expected instanceof Price);
  assert($actual instanceof Price);
  if (!$actual
    ->equals($expected)) {
    throw new ComparisonFailure($expected, $actual, (string) $expected, (string) $actual, FALSE, sprintf('Failed asserting that Price %s matches expected %s.', $actual, $expected));
  }
}