You are here

protected function SearchApiDbTest::buildSearch in Search API Database Search 7

4 calls to SearchApiDbTest::buildSearch()
SearchApiDbTest::checkFacets in ./search_api_db.test
SearchApiDbTest::regressionTests in ./search_api_db.test
Executes regression tests for issues that were already fixed.
SearchApiDbTest::regressionTests2 in ./search_api_db.test
Executes regression tests which are unpractical to run in between.
SearchApiDbTest::uninstallModule in ./search_api_db.test
Tests whether removing the configuration again works as it should.

File

./search_api_db.test, line 183

Class

SearchApiDbTest
Class for testing index and search capabilities using the Database search module.

Code

protected function buildSearch($keys = NULL, array $filters = array(), array $fields = array()) {
  $query = search_api_query($this->index_id);
  if ($keys) {
    $query
      ->keys($keys);
    if ($fields) {
      $query
        ->fields($fields);
    }
  }
  foreach ($filters as $filter) {
    list($field, $value) = explode(',', $filter, 2);
    $query
      ->condition($field, $value);
  }
  $query
    ->range(0, 10);
  return $query;
}