function FieldWebTest::clickSortLoadIdsFromOutput

Same name in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/Handler/FieldWebTest.php \Drupal\Tests\views\Functional\Handler\FieldWebTest::clickSortLoadIdsFromOutput()
  2. 10 core/modules/views/tests/src/Functional/Handler/FieldWebTest.php \Drupal\Tests\views\Functional\Handler\FieldWebTest::clickSortLoadIdsFromOutput()
  3. 11.x 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 129

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.