protected function ParagraphsContentModerationTest::getTableRowWithText

Retrieve a table row containing specified text from a given element.

Parameters

\Behat\Mink\Element\Element $table: The table element.

string $search: The text to search for in the table row.

Return value

\Behat\Mink\Element\NodeElement The row element.

Throws

\Exception

2 calls to ParagraphsContentModerationTest::getTableRowWithText()
ParagraphsContentModerationTest::testModeratedContentNestedParagraphs in paragraphs/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php
Tests the moderated content that includes nested paragraphs.
ParagraphsContentModerationTest::testModeratedParagraphedContent in paragraphs/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php
Tests the moderated paragraphed content.

File

paragraphs/modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php, line 638

Class

ParagraphsContentModerationTest
Tests Paragraphs, Paragraphs Library and Content Moderation integration.

Namespace

Drupal\Tests\paragraphs_library\FunctionalJavascript

Code

protected function getTableRowWithText(Element $table, $search) {
  $rows = $table
    ->findAll('css', 'tr');
  if (empty($rows)) {
    throw new \Exception(sprintf('No rows found on the received table element.'));
  }
  foreach ($rows as $row) {
    if (strpos($row
      ->getText(), $search) !== FALSE) {
      return $row;
    }
  }
  throw new \Exception(sprintf('Failed to find a row containing "%s" on the received table.', $search));
}