function TableSortLegacyTest::testInit

Tests deprecation of the tablesort_init() function.

@expectedDeprecation tablesort_init() is deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use \Drupal\Core\Utility\TableSort::getContextFromRequest() instead. See https://www.drupal.org/node/3009182

File

core/tests/Drupal/KernelTests/Core/Theme/TableSortLegacyTest.php, line 22

Class

TableSortLegacyTest
Deprecation tests cases for the <a href="/api/drupal/core%21includes%21tablesort.inc/8.9.x" title="Functions to aid in the creation of sortable tables." class="local">tablesort.inc</a> file functions.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testInit() {
    $context = tablesort_init([]);
    $this->assertArrayHasKey('query', $context);
    $this->assertArrayHasKey('sort', $context);
}

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