function NodeAccessExampleTestCase::checkSearchResults
Helper function.
On the search page, search for a string and assert the expected number of results.
Parameters
string $search_query: String to search for
int $expected_result_count: Expected result count
1 call to NodeAccessExampleTestCase::checkSearchResults()
- NodeAccessExampleTestCase::testNodeAccessBasic in node_access_example/
node_access_example.test - Test the "private" node access.
File
-
node_access_example/
node_access_example.test, line 277
Class
- NodeAccessExampleTestCase
- Functional tests for the Node Access Example module.
Code
protected 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, 'Found the expected number of search results');
}