You are here

public function ParagraphsContentModerationTest::setUp in Paragraphs 8

Overrides BrowserTestBase::setUp

File

modules/paragraphs_library/tests/src/FunctionalJavascript/ParagraphsContentModerationTest.php, line 62

Class

ParagraphsContentModerationTest
Tests Paragraphs, Paragraphs Library and Content Moderation integration.

Namespace

Drupal\Tests\paragraphs_library\FunctionalJavascript

Code

public function setUp() : void {
  parent::setUp();
  $this
    ->addParagraphedContentType('paragraphed_moderated_test', 'field_paragraphs');
  $this
    ->addParagraphsType('text');
  $this
    ->addFieldtoParagraphType('text', 'field_text', 'text');
  $this
    ->createEditorialWorkflow('paragraphed_moderated_test');
  $type_plugin = $this->workflow
    ->getTypePlugin();
  $type_plugin
    ->addEntityTypeAndBundle('paragraphs_library_item', 'paragraphs_library_item');
  $this->workflow
    ->save();
  $this->adminUser = $this
    ->drupalCreateUser([
    'access administration pages',
    'view any unpublished content',
    'view all revisions',
    'revert all revisions',
    'view latest version',
    'view any unpublished content',
    'use ' . $this->workflow
      ->id() . ' transition create_new_draft',
    'use ' . $this->workflow
      ->id() . ' transition publish',
    'use ' . $this->workflow
      ->id() . ' transition archived_published',
    'use ' . $this->workflow
      ->id() . ' transition archived_draft',
    'use ' . $this->workflow
      ->id() . ' transition archive',
    'administer nodes',
    'bypass node access',
    'administer paragraphs library',
    'access paragraphs_library_items entity browser pages',
    'administer workflows',
  ]);
  $this->editorUser = $this
    ->drupalCreateUser([
    'access content',
    'view all revisions',
    'view any unpublished content',
    'view latest version',
    'use ' . $this->workflow
      ->id() . ' transition create_new_draft',
    'use ' . $this->workflow
      ->id() . ' transition publish',
    'use ' . $this->workflow
      ->id() . ' transition archived_published',
    'use ' . $this->workflow
      ->id() . ' transition archived_draft',
    'use ' . $this->workflow
      ->id() . ' transition archive',
    'access paragraphs_library_items entity browser pages',
    'create paragraph library item',
    'create paragraphed_moderated_test content',
    'edit any paragraphed_moderated_test content',
    'access administration pages',
    'administer paragraphs library',
  ]);
  $this->visitorUser = $this
    ->drupalCreateUser([
    'access content',
    'view all revisions',
  ]);
  $this
    ->drupalPlaceBlock('system_breadcrumb_block');
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalPlaceBlock('local_actions_block');
  $this
    ->drupalPlaceBlock('page_title_block');
  $this
    ->drupalLogin($this->adminUser);
}