You are here

function CommentTranslationUITest::setupBundle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Tests/CommentTranslationUITest.php \Drupal\comment\Tests\CommentTranslationUITest::setupBundle()

Creates or initializes the bundle date if needed.

Overrides ContentTranslationTestBase::setupBundle

File

core/modules/comment/src/Tests/CommentTranslationUITest.php, line 68
Contains \Drupal\comment\Tests\CommentTranslationUITest.

Class

CommentTranslationUITest
Tests the Comment Translation UI.

Namespace

Drupal\comment\Tests

Code

function setupBundle() {
  parent::setupBundle();
  $this
    ->drupalCreateContentType(array(
    'type' => $this->nodeBundle,
    'name' => $this->nodeBundle,
  ));

  // 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(array(
    '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);
}