You are here

function PrivateTestCase::checkSearchResults in Private 7.2

Same name and namespace in other branches
  1. 7 private.test \PrivateTestCase::checkSearchResults()

On the search page, search for a string and assert the expected number of results.

Parameters

$search_query: String to search for

$expected_result_count: Expected result count

1 call to PrivateTestCase::checkSearchResults()
PrivateTestCase::testNodeAccessBasic in ./private.test
Test the "private" node access.

File

./private.test, line 150
Tests for private module.

Class

PrivateTestCase
@file Tests for private module.

Code

function checkSearchResults($search_query, $expected_result_count) {
  $this
    ->drupalPost('search/node', array(
    'keys' => $search_query,
  ), t('Search'));
  $search_results = $this
    ->xpath("//ol[contains(@class, 'search-results')]/li");
  $this
    ->assertEqual(count($search_results), $expected_result_count, t('Found the expected number of search results'));
}