You are here

protected function ModerationDashboardPersonalizedComponentsTest::setUp in Moderation Dashboard 2.0.x

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

Throws

\Drupal\Core\Entity\EntityStorageException

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);
}