function SelectTableSortDefaultTest::testTableSortDefaultSort

Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php \Drupal\Tests\system\Functional\Database\SelectTableSortDefaultTest::testTableSortDefaultSort()
  2. 10 core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php \Drupal\Tests\system\Functional\Database\SelectTableSortDefaultTest::testTableSortDefaultSort()
  3. 11.x core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php \Drupal\Tests\system\Functional\Database\SelectTableSortDefaultTest::testTableSortDefaultSort()

Confirms that tableselect is rendered without error.

Specifically that no sort is set in a tableselect, and that header links are correct.

File

core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php, line 81

Class

SelectTableSortDefaultTest
Tests the tablesort query extender.

Namespace

Drupal\Tests\system\Functional\Database

Code

public function testTableSortDefaultSort() {
    $assert = $this->assertSession();
    $this->drupalGet('database_test/tablesort_default_sort');
    // Verify that the table was displayed. Just the header is checked for
    // because if there were any fatal errors or exceptions in displaying the
    // sorted table, it would not print the table.
    $assert->pageTextContains('Username');
    // Verify that the header links are built properly.
    $assert->linkByHrefExists('database_test/tablesort_default_sort');
    $assert->responseMatches('/\\<a.*title\\=\\"sort by Username\\".*\\>/');
}

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