You are here

protected function FieldWebTest::clickSortLoadIdsFromOutput in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Functional/Handler/FieldWebTest.php \Drupal\Tests\views\Functional\Handler\FieldWebTest::clickSortLoadIdsFromOutput()

Small helper function to get all ids in the output.

Return value

array A list of beatle ids.

1 call to FieldWebTest::clickSortLoadIdsFromOutput()
FieldWebTest::testClickSorting in core/modules/views/tests/src/Functional/Handler/FieldWebTest.php
Tests the click sorting functionality.

File

core/modules/views/tests/src/Functional/Handler/FieldWebTest.php, line 126

Class

FieldWebTest
Tests fields from within a UI.

Namespace

Drupal\Tests\views\Functional\Handler

Code

protected function clickSortLoadIdsFromOutput() {
  $fields = $this
    ->xpath("//td[contains(@class, 'views-field-id')]");
  $ids = [];
  foreach ($fields as $field) {
    $ids[] = (int) $field
      ->getText();
  }
  return $ids;
}