You are here

public function ModerationStateNodeTest::testPagers in Workbench Moderation 8.2

Tests pagers aren't broken by workbench_moderation.

File

src/Tests/ModerationStateNodeTest.php, line 113

Class

ModerationStateNodeTest
Tests general content moderation workflow for nodes.

Namespace

Drupal\workbench_moderation\Tests

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 = (string) $element[0]['href'];
  $query = [];
  parse_str(parse_url($url, PHP_URL_QUERY), $query);
  $this
    ->assertEqual(0, $query['page']);
}