You are here

protected function AbstractSearchSynonymsWebTestCase::getSearchResults in Synonyms 7

Retrieve search results.

Parameters

$keyword string: Keyword to supply to the search mechanism

Return value

array Array of HTML search results. Each element in this array is a single search result represented in HTML code as Drupal search mechanism outputs it

2 calls to AbstractSearchSynonymsWebTestCase::getSearchResults()
NodeSearchSynonymsWebTestCase::assertSearchResults in synonyms_search/synonyms_search.test
Assert search results.
TermSearchSynonymsWebTestCase::assertSearchResults in synonyms_search/synonyms_search.test
Assert search results.

File

synonyms_search/synonyms_search.test, line 96
Tests for the Synonyms Search module.

Class

AbstractSearchSynonymsWebTestCase
Base class for tests of Synonyms Search module.

Code

protected function getSearchResults($keyword) {
  $response = $this
    ->drupalGet('search/' . $this->search_type . '/' . $keyword);
  $matches = array();
  preg_match_all('#\\<li[^>]+class="search-result"[^>]*\\>(.*?)\\</li\\>#si', $response, $matches);
  return $matches[1];
}