function CommentUriDeprecationTest::setUp

Overrides EntityKernelTestBase::setUp

File

core/modules/comment/tests/src/Kernel/CommentUriDeprecationTest.php, line 35

Class

CommentUriDeprecationTest
Performs kernel tests on the deprecation of the comment_uri method.

Namespace

Drupal\Tests\comment\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this->installSchema('comment', [
    'comment_entity_statistics',
  ]);
  $this->installConfig([
    'comment',
  ]);
  // Create a page node type.
  $this->entityTypeManager
    ->getStorage('node_type')
    ->create([
    'type' => 'page',
    'name' => 'page',
  ])
    ->save();
  // Create a comment type.
  CommentType::create([
    'id' => 'comment',
    'label' => 'Default comments',
    'description' => 'Default comment field',
    'target_entity_type_id' => 'node',
  ])->save();
  // Add comment field to the page content type.
  $this->addDefaultCommentField('node', 'page', 'comment');
  // Create user to add comments.
  $this->commentUser = $this->drupalCreateUser([
    'access comments',
    'post comments',
    'create page content',
    'edit own comments',
    'skip comment approval',
    'access content',
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.