You are here

protected function PbfBaseTest::checkSearchResults in Permissions by field 8

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

Parameters

string $search_query: String to search for.

int $expected_result_count: Expected result count.

8 calls to PbfBaseTest::checkSearchResults()
PbfAccessByNodeRefTest::testPbfAccessByNodeRef in tests/src/Functional/PbfAccessByNodeRefTest.php
Test the "pbf" node access with a Pbf field which reference node.
PbfAccessByRoleTest::testPbfAccessByRole in tests/src/Functional/PbfAccessByRoleTest.php
Test the "pbf" node access with a Pbf field which reference role.
PbfAccessByTermRefTest::testPbfAccessByTermRef in tests/src/Functional/PbfAccessByTermRefTest.php
Test the "pbf" node access with a Pbf field which reference term.
PbfAccessByUserDirectTest::testPbfAccessByUser in tests/src/Functional/PbfAccessByUserDirectTest.php
Test the "pbf" node access with a Pbf field which reference directly user.
PbfAccessByUserRefTest::testPbfAccessByUserRef in tests/src/Functional/PbfAccessByUserRefTest.php
Test the "pbf" node access with a Pbf field which reference user.

... See full list

File

tests/src/Functional/PbfBaseTest.php, line 224

Class

PbfBaseTest
General setup and helper function for testing pbf module.

Namespace

Drupal\Tests\pbf\Functional

Code

protected function checkSearchResults($search_query, $expected_result_count) {
  $this
    ->drupalPostForm('search/node', array(
    'keys' => $search_query,
  ), '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'));
}