public function EntityListBuilderTest::testPager in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php \Drupal\Tests\system\Functional\Entity\EntityListBuilderTest::testPager()
- 10 core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php \Drupal\Tests\system\Functional\Entity\EntityListBuilderTest::testPager()
Tests paging.
File
- core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityListBuilderTest.php, line 42
Class
- EntityListBuilderTest
- Tests entity list builder functionality.
Namespace
Drupal\Tests\system\Functional\EntityCode
public function testPager() {
// Create 51 test entities.
for ($i = 1; $i < 52; $i++) {
EntityTest::create([
'name' => 'Test entity ' . $i,
])
->save();
}
// Load the listing page.
$this
->drupalGet('entity_test/list');
// Item 51 should not be present.
$this
->assertSession()
->pageTextContains('Test entity 50');
$this
->assertSession()
->responseNotContains('Test entity 51');
// Browse to the next page, test entity 51 is shown.
$this
->clickLink('Page 2');
$this
->assertSession()
->responseNotContains('Test entity 50');
$this
->assertSession()
->pageTextContains('Test entity 51');
}