You are here

protected function ModerationDashboardPersonalizedComponentsTest::setUp in Moderation Dashboard 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/ModerationDashboardPersonalizedComponentsTest.php \Drupal\Tests\moderation_dashboard\Functional\ModerationDashboardPersonalizedComponentsTest::setUp()

Overrides ModerationDashboardTestBase::setUp

File

tests/src/Functional/ModerationDashboardPersonalizedComponentsTest.php, line 60

Class

ModerationDashboardPersonalizedComponentsTest
Tests personalized moderation dashboard components.

Namespace

Drupal\Tests\moderation_dashboard\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->moderatorUser = $this
    ->createUser($this->userPermissions, 'moderator user');
  $this->regularUser = $this
    ->createUser([
    'access content',
    'use moderation dashboard',
  ], 'regular user');
  foreach ([
    $this->user,
    $this->moderatorUser,
    $this->regularUser,
  ] as $user) {
    $this
      ->drupalCreateNode([
      'title' => 'Draft node of ' . $user
        ->getDisplayName(),
      'moderation_state' => 'draft',
      'uid' => $user
        ->id(),
    ]);
    $this
      ->drupalCreateNode([
      'title' => 'Published node of ' . $user
        ->getDisplayName(),
      'moderation_state' => 'published',
      'uid' => $user
        ->id(),
    ]);
  }
  $this
    ->drupalLogin($this->user);
}