protected function TermSearchSynonymsWebTestCase::assertSearchResults in Synonyms 7
Assert search results.
Parameters
$keyword string: Keyword to supply to the search mechanism
$results array: Array of fully loaded terms that are expected to be on search results
$message string: Drupal assertion message to display on test results page
1 call to TermSearchSynonymsWebTestCase::assertSearchResults()
- TermSearchSynonymsWebTestCase::testSearchTermSynonym in synonyms_search/
synonyms_search.test - Test searching terms by their synonyms.
File
- synonyms_search/
synonyms_search.test, line 441 - Tests for the Synonyms Search module.
Class
- TermSearchSynonymsWebTestCase
- Test Synonyms module integration with Drupal search for taxonomy terms.
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 $term) {
if (strpos($matches, 'taxonomy/term/' . $term->tid) === FALSE) {
$this
->fail($message);
return;
}
}
$this
->pass($message);
}