You are here

public function MarkupInterfaceComparator::accepts in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/TestTools/Comparator/MarkupInterfaceComparator.php \Drupal\TestTools\Comparator\MarkupInterfaceComparator::accepts()

File

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

Class

MarkupInterfaceComparator
Compares MarkupInterface objects for equality.

Namespace

Drupal\TestTools\Comparator

Code

public function accepts($expected, $actual) {

  // 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;
}