You are here

protected function RecipientTypePluginsTest::setUp in Workbench Email 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/RecipientTypePluginsTest.php \Drupal\Tests\workbench_email\Kernel\RecipientTypePluginsTest::setUp()

Overrides KernelTestBase::setUp

File

tests/src/Kernel/RecipientTypePluginsTest.php, line 66

Class

RecipientTypePluginsTest
Defines a class for testing handlers.

Namespace

Drupal\Tests\workbench_email\Kernel

Code

protected function setUp() {
  parent::setUp();
  parent::setUp();
  $this
    ->installEntitySchema('node');
  $this
    ->installConfig([
    'node',
    'workbench_moderation',
    'workbench_email',
    'system',
    'filter',
  ]);
  $this
    ->installEntitySchema('user');
  $this
    ->installSchema('system', [
    'key_value',
    'sequences',
  ]);
  $this
    ->installSchema('node', [
    'node_access',
  ]);
  $node_type = $this
    ->createContentType([
    'type' => 'test',
  ]);
  $this
    ->setUpModerationForNodeType($node_type);
  $this
    ->setUpEmailFieldForNodeBundle();
  $this
    ->createEntityReferenceField('node', 'test', 'field_approver', 'Approver', 'user');
  Role::create([
    'id' => 'editor',
  ])
    ->save();
  $editor = $this
    ->createUser([
    'use draft_needs_review transition',
  ]);
  $editor
    ->setEmail('editor@example.com');
  $editor
    ->addRole('editor');
  $editor
    ->save();
  $editor2 = $this
    ->createUser([
    'use draft_needs_review transition',
  ]);
  $editor2
    ->setEmail('editor2@example.com');
  $editor2
    ->addRole('editor');
  $editor2
    ->save();
  \Drupal::service('account_switcher')
    ->switchTo($editor);
  $this->author = $this
    ->createUser();
  $this->author
    ->setEmail('author@example.com');
  $this->author
    ->save();
  $this->lastAuthor = $this
    ->createUser();
  $this->lastAuthor
    ->setEmail('last-author@example.com');
  $this->lastAuthor
    ->save();
  $this->approver = $this
    ->createUser();
  $this->approver
    ->setEmail('approver@example.com');
  $this->approver
    ->save();
}