You are here

protected function SearchApiWebTest::searchSuccess in Search API 7

Tests whether searches yield the right results after indexing.

The test server only implements range functionality, no kind of fulltext search capabilities, so we can only test for that.

1 call to SearchApiWebTest::searchSuccess()
SearchApiWebTest::testFramework in ./search_api.test
Tests correct admin UI, indexing and search behavior.

File

./search_api.test, line 495
Contains the SearchApiWebTest and the SearchApiUnitTest classes.

Class

SearchApiWebTest
Class for testing Search API functionality via the UI.

Code

protected function searchSuccess() {
  $results = $this
    ->doSearch();
  $this
    ->assertEqual($results['result count'], 10, 'Correct search result count returned after indexing.');
  $this
    ->assertEqual(array_keys($results['results']), array(
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
  ), 'Correct search results returned after indexing.');
  $results = $this
    ->doSearch(2, 4);
  $this
    ->assertEqual($results['result count'], 10, 'Correct search result count with ranged query.');
  $this
    ->assertEqual(array_keys($results['results']), array(
    3,
    4,
    5,
    6,
  ), 'Correct search results with ranged query.');
}