public function EntityListBuilderTest::testPager in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Entity/EntityListBuilderTest.php \Drupal\system\Tests\Entity\EntityListBuilderTest::testPager()
Test paging.
File
- core/modules/ system/ src/ Tests/ Entity/ EntityListBuilderTest.php, line 41 
- Contains \Drupal\system\Tests\Entity\EntityListBuilderTest.
Class
- EntityListBuilderTest
- Tests entity list builder functionality.
Namespace
Drupal\system\Tests\EntityCode
public function testPager() {
  // Create 51 test entities.
  for ($i = 1; $i < 52; $i++) {
    entity_create('entity_test', array(
      'name' => 'Test entity ' . $i,
    ))
      ->save();
  }
  // Load the listing page.
  $this
    ->drupalGet('entity_test/list');
  // Item 51 should not be present.
  $this
    ->assertRaw('Test entity 50', 'Item 50 is shown.');
  $this
    ->assertNoRaw('Test entity 51', 'Item 51 is on the next page.');
  // Browse to the next page.
  $this
    ->clickLink(t('Page 2'));
  $this
    ->assertNoRaw('Test entity 50', 'Test entity 50 is on the previous page.');
  $this
    ->assertRaw('Test entity 51', 'Test entity 51 is shown.');
}