Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NumericComparator.php

function NumericComparator::assertEquals

Throws

ComparisonFailure

Overrides ScalarComparator::assertEquals

File

vendor/sebastian/comparator/src/NumericComparator.php, line 33

Class

NumericComparator

Namespace

SebastianBergmann\Comparator

Code

public function assertEquals(mixed $expected, mixed $actual, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) : void {
    if ($this->isInfinite($actual) && $this->isInfinite($expected)) {
        return;
    }
    if (($this->isInfinite($actual) xor $this->isInfinite($expected)) || ($this->isNan($actual) || $this->isNan($expected)) || abs($actual - $expected) > $delta) {
        $exporter = new Exporter();
        throw new ComparisonFailure($expected, $actual, '', '', sprintf('Failed asserting that %s matches expected %s.', $exporter->export($actual), $exporter->export($expected)));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal