You are here

protected function LikeAndDislikeTest::setUp in Like & Dislike 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/LikeAndDislikeTest.php, line 53

Class

LikeAndDislikeTest
Provides a web test for like_and_dislike module.

Namespace

Drupal\Tests\like_and_dislike\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();

  // Create a node type.
  $node_type = NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $node_type
    ->save();

  // Create a comment type.
  $comment_type = CommentType::create([
    'id' => 'comment',
    'label' => 'Default comments',
    'description' => 'Default comment field',
    'target_entity_type_id' => 'article',
  ]);
  $comment_type
    ->save();
  $this
    ->addDefaultCommentField('node', 'article', 'test_comment_field', CommentItemInterface::OPEN, 'test_comment_type');

  // Create a user with admin permissions and login as this user.
  $admin_permissions = [
    'administer like and dislike',
    'administer node display',
    'administer user display',
    'administer comment display',
    'administer display modes',
    'access comments',
    'administer permissions',
  ];
  $this->adminUser = $this
    ->drupalCreateUser($admin_permissions);
  $this
    ->drupalLogin($this->adminUser);
}