function PreprocessPagerTest::testEmptyPaginationHeadingLevelSet

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

Tests template_preprocess_pager() when an empty #pagination_heading_level value is passed.

@covers ::template_preprocess_pager

File

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

Class

PreprocessPagerTest
Tests pager preprocessing.

Namespace

Drupal\Tests\system\Unit\Pager

Code

public function testEmptyPaginationHeadingLevelSet() : void {
  require_once $this->root . '/core/includes/theme.inc';
  $variables = [
    'pager' => [
      '#element' => '2',
      '#pagination_heading_level' => '',
      '#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.