You are here

public function SchedulerScheduledContentListAccessTest::testViewScheduledContentOverview in Scheduler 8

Tests the scheduled content overview.

File

tests/src/Functional/SchedulerScheduledContentListAccessTest.php, line 117

Class

SchedulerScheduledContentListAccessTest
Tests access to the scheduled content overview page and user tab.

Namespace

Drupal\Tests\scheduler\Functional

Code

public function testViewScheduledContentOverview() {
  $assert = $this
    ->assertSession();

  // Access the scheduled content overview as anonymous visitor.
  $this
    ->drupalGet('admin/content/scheduled');
  $assert
    ->statusCodeEquals(403);

  // Access the scheduled content overview as "Editor" without any
  // scheduler permissions.
  $this
    ->drupalLogin($this->editorUser);
  $this
    ->drupalGet('admin/content/scheduled');
  $assert
    ->statusCodeEquals(403);

  // Access the scheduled content overview as "Scheduler User" with only
  // 'schedule publishing of nodes' permission.
  $this
    ->drupalLogin($this->schedulerUser);
  $this
    ->drupalGet('admin/content/scheduled');
  $assert
    ->statusCodeEquals(403);

  // Access the scheduled content overview as "Scheduler Manager" with only
  // 'view scheduled content' permission. They should be able to see the
  // scheduled published and unpublished content by all users.
  $this
    ->drupalLogin($this->schedulerManager);
  $this
    ->drupalGet('admin/content/scheduled');
  $assert
    ->statusCodeEquals(200);
  $assert
    ->pageTextContains('Node created by Scheduler User for publishing');
  $assert
    ->pageTextContains('Node created by Scheduler User for unpublishing');
  $assert
    ->pageTextContains('Node created by Scheduler Manager for publishing');
  $assert
    ->pageTextContains('Node created by Scheduler Manager for unpublishing');
}