You are here

public function ModerationStateNodeTest::testPagers in Workbench Moderation 8

Tests pagers aren't broken by workbench_moderation.

File

tests/src/Functional/ModerationStateNodeTest.php, line 113

Class

ModerationStateNodeTest
Tests general content moderation workflow for nodes.

Namespace

Drupal\Tests\workbench_moderation\Functional

Code

public function testPagers() {

  // Create 51 nodes to force the pager.
  foreach (range(1, 51) as $delta) {
    Node::create([
      'type' => 'moderated_content',
      'uid' => $this->adminUser
        ->id(),
      'title' => 'Node ' . $delta,
      'status' => 1,
      'moderation_state' => 'published',
    ])
      ->save();
  }
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/content');
  $element = $this
    ->cssSelect('nav.pager li.is-active a');
  $url = $element[0]
    ->getAttribute('href');
  $query = [];
  parse_str(parse_url($url, PHP_URL_QUERY), $query);
  $this
    ->assertEquals(0, $query['page']);
}