You are here

protected function SearchApiBulkFormTest::getRowContainingText in Search API 8

Returns a table row containing the given text.

Parameters

string $text: Text contained in the row.

Return value

\Behat\Mink\Element\NodeElement A table row containing the given text.

3 calls to SearchApiBulkFormTest::getRowContainingText()
SearchApiBulkFormTest::assertCheckboxExistsInRow in tests/src/Functional/SearchApiBulkFormTest.php
Asserts that a checkbox exists in the Views row containing the given text.
SearchApiBulkFormTest::assertCheckboxNotExistsInRow in tests/src/Functional/SearchApiBulkFormTest.php
Asserts that no checkbox exists in the Views row containing the given text.
SearchApiBulkFormTest::checkCheckboxInRow in tests/src/Functional/SearchApiBulkFormTest.php
Checks the checkbox in the Views row containing the given text.

File

tests/src/Functional/SearchApiBulkFormTest.php, line 250

Class

SearchApiBulkFormTest
Tests the Search API bulk form Views field plugin.

Namespace

Drupal\Tests\search_api\Functional

Code

protected function getRowContainingText(string $text) : NodeElement {
  $rows = $this
    ->getSession()
    ->getPage()
    ->findAll('css', 'tr');
  $this
    ->assertNotEmpty($rows, 'No rows found on the page.');
  $found = FALSE;

  /** @var \Behat\Mink\Element\NodeElement $row */
  foreach ($rows as $row) {
    if (strpos($row
      ->getText(), $text) !== FALSE) {
      $found = TRUE;
      break;
    }
  }
  $this
    ->assertTrue($found, "No row with text \"{$text}\" found on the page.");
  return $row;
}