You are here

protected function NodeSearchSynonymsWebTestCase::assertSearchResults in Synonyms 7

Assert search results.

Parameters

$keyword string: Keyword to supply to the search mechanism

$results array: Array of fully loaded nodes that are expected to be on search results

$message string: Drupal assertion message to display on test results page

2 calls to NodeSearchSynonymsWebTestCase::assertSearchResults()
NodeSearchSynonymsWebTestCase::testSearchTermSynonym in synonyms_search/synonyms_search.test
Test searching nodes by a term synonym.
NodeSearchSynonymsWebTestCase::testSearchTermSynonymEntityReference in synonyms_search/synonyms_search.test
Test searching nodes by a term synonym when referenced by entity reference.

File

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

Class

NodeSearchSynonymsWebTestCase
Test Synonyms module integration with Drupal search functionality for nodes.

Code

protected function assertSearchResults($keyword, $results, $message) {
  $matches = $this
    ->getSearchResults($keyword);
  if (count($matches) != count($results)) {
    $this
      ->fail($message);
    return;
  }
  $matches = implode('', $matches);
  foreach ($results as $node) {
    if (strpos($matches, 'node/' . $node->nid) === FALSE) {
      $this
        ->fail($message);
      return;
    }
  }
  $this
    ->pass($message);
}