You are here

function SelectTableSortDefaultTest::testTableSortDefaultSort in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/SelectTableSortDefaultTest.php \Drupal\system\Tests\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/src/Tests/Database/SelectTableSortDefaultTest.php, line 79
Contains \Drupal\system\Tests\Database\SelectTableSortDefaultTest.

Class

SelectTableSortDefaultTest
Tests the tablesort query extender.

Namespace

Drupal\system\Tests\Database

Code

function testTableSortDefaultSort() {
  $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.
  $this
    ->assertText(t('Username'));

  // Verify that the header links are built properly.
  $this
    ->assertLinkByHref('database_test/tablesort_default_sort');
  $this
    ->assertPattern('/\\<a.*title\\=\\"' . t('sort by Username') . '\\".*\\>/');
}