You are here

function DrupalSolrMatchTestCase::_setup in Apache Solr Search 6

Same name and namespace in other branches
  1. 6.2 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_setup()

Set up a small index of items to test against.

1 call to DrupalSolrMatchTestCase::_setup()
DrupalSolrMatchTestCase::testMatching in tests/solr_index_and_search.test
Test search indexing.

File

tests/solr_index_and_search.test, line 41
Tests for the apachsolr module: index and search.

Class

DrupalSolrMatchTestCase
@file Tests for the apachsolr module: index and search.

Code

function _setup() {
  $ping = $this->solr
    ->ping(10);
  $this
    ->assertNotEqual(FALSE, $ping, "The Server could be Pinged");
  $response = $this->solr
    ->search("*:*");
  $response = $response->response;
  $total = $response->numFound;
  $this
    ->assertEqual($total, 0, "There should not be any documents in the index");
  variable_set('minimum_word_size', 3);
  for ($i = 1; $i <= 7; ++$i) {
    $documents[] = $this
      ->_solr_build_document($i, array(
      'nid' => $i,
      'text' => $this
        ->getText($i),
    ));
  }
  $this
    ->_solr_index($documents);
}