You are here

protected function SchedulerScheduledContentListAccessTest::setUp in Scheduler 8

Overrides SchedulerBrowserTestBase::setUp

File

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

Class

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

Namespace

Drupal\Tests\scheduler\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $base_permissions = [
    'access content',
    'create ' . $this->type . ' content',
    'view own unpublished content',
  ];
  $this->editorUser = $this
    ->drupalCreateUser(array_merge($base_permissions, [
    'access content overview',
  ]));
  $this->schedulerUser = $this
    ->drupalCreateUser(array_merge($base_permissions, [
    'schedule publishing of nodes',
  ]));
  $this->schedulerManager = $this
    ->drupalCreateUser(array_merge($base_permissions, [
    'view scheduled content',
  ]));

  // Create nodes scheduled for publishing and for unpublishing.
  $this->node1 = $this
    ->drupalCreateNode([
    'title' => 'Node created by Scheduler User for publishing',
    'uid' => $this->schedulerUser
      ->id(),
    'status' => FALSE,
    'type' => $this->type,
    'publish_on' => strtotime('+1 week'),
  ]);
  $this->node2 = $this
    ->drupalCreateNode([
    'title' => 'Node created by Scheduler User for unpublishing',
    'uid' => $this->schedulerUser
      ->id(),
    'status' => TRUE,
    'type' => $this->type,
    'unpublish_on' => strtotime('+1 week'),
  ]);
  $this->node3 = $this
    ->drupalCreateNode([
    'title' => 'Node created by Scheduler Manager for publishing',
    'uid' => $this->schedulerManager
      ->id(),
    'status' => FALSE,
    'type' => $this->type,
    'publish_on' => strtotime('+1 week'),
  ]);
  $this->node4 = $this
    ->drupalCreateNode([
    'title' => 'Node created by Scheduler Manager for unpublishing',
    'uid' => $this->schedulerManager
      ->id(),
    'status' => TRUE,
    'type' => $this->type,
    'unpublish_on' => strtotime('+1 week'),
  ]);
}