function PreprocessPagerTest::testPaginationHeadingLevelInvalid

Same name and namespace in other branches
  1. 10 core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php \Drupal\Tests\system\Unit\Pager\PreprocessPagerTest::testPaginationHeadingLevelInvalid()

Test template_preprocess_pager() with an invalid #pagination_heading_level.

@covers ::template_preprocess_pager

File

core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php, line 166

Class

PreprocessPagerTest
Tests pager preprocessing.

Namespace

Drupal\Tests\system\Unit\Pager

Code

public function testPaginationHeadingLevelInvalid() : void {
    require_once $this->root . '/core/includes/theme.inc';
    $variables = [
        'pager' => [
            '#element' => '2',
            '#pagination_heading_level' => 'not-a-heading-element',
            '#parameters' => [],
            '#quantity' => '2',
            '#route_name' => '',
            '#tags' => '',
        ],
    ];
    template_preprocess_pager($variables);
    $this->assertEquals('h4', $variables['pagination_heading_level']);
}

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