1 node_access_example.test protected NodeAccessExampleTestCase::checkSearchResults($search_query, $expected_result_count)

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

File

modules/examples/node_access_example/node_access_example.test, line 265
Tests for Node Access example module.

Class

NodeAccessExampleTestCase
Functional tests for the Node Access Example module.

Code

protected function checkSearchResults($search_query, $expected_result_count) {
  $this->backdropPost('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');
}