public function PagerTest::testPagerEllipsis in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Functional/Pager/PagerTest.php \Drupal\Tests\system\Functional\Pager\PagerTest::testPagerEllipsis()
- 10 core/modules/system/tests/src/Functional/Pager/PagerTest.php \Drupal\Tests\system\Functional\Pager\PagerTest::testPagerEllipsis()
Test proper functioning of the ellipsis.
File
- core/
modules/ system/ tests/ src/ Functional/ Pager/ PagerTest.php, line 196
Class
- PagerTest
- Tests pager functionality.
Namespace
Drupal\Tests\system\Functional\PagerCode
public function testPagerEllipsis() {
// Insert 100 extra log messages to get 9 pages.
$logger = $this->container
->get('logger.factory')
->get('pager_test');
for ($i = 0; $i < 100; $i++) {
$logger
->debug($this
->randomString());
}
$this
->drupalGet('admin/reports/dblog');
$elements = $this
->cssSelect(".pager__item--ellipsis:contains('…')");
$this
->assertCount(0, $elements, 'No ellipsis has been set.');
// Insert an extra 50 log messages to get 10 pages.
$logger = $this->container
->get('logger.factory')
->get('pager_test');
for ($i = 0; $i < 50; $i++) {
$logger
->debug($this
->randomString());
}
$this
->drupalGet('admin/reports/dblog');
$elements = $this
->cssSelect(".pager__item--ellipsis:contains('…')");
$this
->assertCount(1, $elements, 'Found the ellipsis.');
}