function 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 89

Class

SelectTableSortDefaultTest
Tests the tablesort query extender.

Namespace

Drupal\Tests\system\Functional\Database

Code

public function testTableSortDefaultSort() : void {
  $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.