You are here

public function PagerManagerTest::testDefaultInitializeGlobals in Drupal 8

@covers ::createPager

File

core/tests/Drupal/KernelTests/Core/Pager/PagerManagerTest.php, line 18

Class

PagerManagerTest
@group Pager

Namespace

Drupal\KernelTests\Core\Pager

Code

public function testDefaultInitializeGlobals() {
  $pager_globals = [
    'pager_page_array',
    'pager_total_items',
    'pager_total',
    'pager_limits',
  ];
  foreach ($pager_globals as $pager_global) {
    $this
      ->assertFalse(isset($GLOBALS[$pager_global]));
  }

  /* @var $pager_manager \Drupal\Core\Pager\PagerManagerInterface */
  $pager_manager = $this->container
    ->get('pager.manager');
  $pager_manager
    ->createPager(5, 1);
  foreach ($pager_globals as $pager_global) {
    $this
      ->assertTrue(isset($GLOBALS[$pager_global]));
  }
}