protected function SearchApiUnitTest::deepEquals in Search API 7
Tests whether two values are equal.
For arrays, this is done by comparing the key/value pairs recursively instead of checking for simple equality.
Parameters
mixed $first: The first value.
mixed $second: The second value.
Return value
bool TRUE if the two values are equal, FALSE otherwise.
1 call to SearchApiUnitTest::deepEquals()
- SearchApiUnitTest::assertEqual in ./
search_api.test - Overrides DrupalTestCase::assertEqual().
File
- ./
search_api.test, line 801 - Contains the SearchApiWebTest and the SearchApiUnitTest classes.
Class
- SearchApiUnitTest
- Class with unit tests testing small fragments of the Search API.
Code
protected function deepEquals($first, $second) {
if (!is_array($first) || !is_array($second)) {
return $first == $second;
}
$first = array_merge($first);
$second = array_merge($second);
foreach ($first as $key => $value) {
if (!array_key_exists($key, $second) || !$this
->deepEquals($value, $second[$key])) {
return FALSE;
}
unset($second[$key]);
}
return empty($second);
}