function CommentTranslationUITest::setupBundle

Same name and namespace in other branches
  1. 9 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::setupBundle()
  2. 8.9.x core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::setupBundle()
  3. 10 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::setupBundle()

Overrides ContentTranslationTestBase::setupBundle

File

core/modules/comment/tests/src/Functional/CommentTranslationUITest.php, line 82

Class

CommentTranslationUITest
Tests the Comment Translation UI.

Namespace

Drupal\Tests\comment\Functional

Code

public function setupBundle() {
    parent::setupBundle();
    $this->drupalCreateContentType([
        'type' => 'article',
        'name' => 'article',
    ]);
    // Add a comment field to the article content type.
    $this->addDefaultCommentField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
    // Create a page content type.
    $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'page',
    ]);
    // Add a comment field to the page content type - this one won't be
    // translatable.
    $this->addDefaultCommentField('node', 'page', 'comment');
    // Mark this bundle as translatable.
    $this->container
        ->get('content_translation.manager')
        ->setEnabled('comment', 'comment_article', TRUE);
}

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