You are here

protected function CommentAlterTestBase::setUp in Comment Alter 8

{@inheritoc}

Overrides BrowserTestBase::setUp

File

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

Class

CommentAlterTestBase
Base class for Comment Alter test cases.

Namespace

Drupal\Tests\comment_alter\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->entityType = 'entity_test_rev';

  // By default this bundle is there.
  $this->bundle = 'entity_test_rev';
  CommentType::create([
    'id' => 'comment',
    'label' => 'Comment',
    'description' => 'Comment type for Comment Alter',
    'target_entity_type_id' => $this->entityType,
  ])
    ->save();

  // Add a comment field on entity_test_bundle.
  $this
    ->addDefaultCommentField($this->entityType, $this->bundle);

  // Provide necessary permissions to the adminUser.
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer comments',
    'post comments',
    'access comments',
    'skip comment approval',
    'view test entity',
    'view test entity field',
    'administer entity_test content',
    'access administration pages',
  ]);
  $this
    ->drupalLogin($this->adminUser);
}