function MarkupInterfaceComparator::accepts

Same name in other branches
  1. 9 core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php \Drupal\TestTools\Comparator\MarkupInterfaceComparator::accepts()
  2. 8.9.x core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php \Drupal\TestTools\Comparator\MarkupInterfaceComparator::accepts()
  3. 11.x core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php \Drupal\TestTools\Comparator\MarkupInterfaceComparator::accepts()

File

core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php, line 18

Class

MarkupInterfaceComparator
Compares MarkupInterface objects for equality.

Namespace

Drupal\TestTools\Comparator

Code

public function accepts($expected, $actual) : bool {
    // If at least one argument is a MarkupInterface object, we take over and
    // convert to strings before comparing.
    return $expected instanceof MarkupInterface && $actual instanceof MarkupInterface || $expected instanceof MarkupInterface && is_scalar($actual) || is_scalar($expected) && $actual instanceof MarkupInterface;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.