You are here

abstract class DrupalSolrOfflineWebTestCase in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 tests/apachesolr_base.test \DrupalSolrOfflineWebTestCase
  2. 7 tests/apachesolr_base.test \DrupalSolrOfflineWebTestCase

Hierarchy

Expanded class hierarchy of DrupalSolrOfflineWebTestCase

File

tests/apachesolr_base.test, line 3
Unit test class that provides tests for base functionality of the Apachesolr Module without having the need of a Solr Server

View source
abstract class DrupalSolrOfflineWebTestCase extends DrupalWebTestCase {
  function _nestedCompare($a1, $a2) {
    if (count($a1) != count($a2)) {
      $extra1 = array_diff_key($a1, $a2);
      $extra2 = array_diff_key($a2, $a1);
      $extra = '';
      if ($extra1) {
        $extra .= ' Extra keys in $a1: ' . implode(', ', array_keys($extra1));
      }
      if ($extra2) {
        $extra .= ' Extra keys in $a2: ' . implode(', ', array_keys($extra2));
      }
      debug('count($a1) != count($a2) :' . $extra);
      return FALSE;
    }
    foreach ($a1 as $k => $v) {
      if (!isset($a2[$k])) {
        debug("\$a2[{$k}] is not set");
        return FALSE;
      }
      if (is_array($a1[$k]) && is_array($a2[$k])) {
        if (!$this
          ->_nestedCompare($a1[$k], $a2[$k])) {
          debug("_nestedCompare(\$a1[{$k}], \$a2[{$k}]) is false");
          return FALSE;
        }
      }
      elseif ($a1[$k] !== $a2[$k]) {
        debug("\$a1[{$k}] !== \$a2[{$k}] : " . var_export($a1[$k], TRUE) . " " . var_export($a2[$k], TRUE));
        return FALSE;
      }
    }
    return TRUE;
  }

}

Members