You are here

function DrupalSolrMatchTestCase::_testQueryMatching in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryMatching()
  2. 6.3 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryMatching()
  3. 6 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryMatching()
  4. 6.2 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_testQueryMatching()

Test the matching abilities of the engine.

Verify if a query produces the correct results.

1 call to DrupalSolrMatchTestCase::_testQueryMatching()
DrupalSolrMatchTestCase::_testQueries in tests/solr_index_and_search.test
Run predefine queries looking for indexed terms.

File

tests/solr_index_and_search.test, line 321

Class

DrupalSolrMatchTestCase

Code

function _testQueryMatching($query, $set, $results) {

  // Get result IDs.
  $found = array();
  foreach ($set as $item) {
    $found[] = $item->entity_id;
  }

  // Compare $results and $found.
  sort($found);
  sort($results);
  $this
    ->assertEqual($found, $results, strtr("Query matching '{$query}' found: @found expected: @expected", array(
    '@found' => implode(',', $found),
    '@expected' => implode(',', $results),
  )));
}