function setUp()
 {
     parent::setUp();
     $this->drupalLogin($this->drupalCreateUser(['access comments']));
     // Add two new languages.
     ConfigurableLanguage::createFromLangcode('fr')->save();
     ConfigurableLanguage::createFromLangcode('es')->save();
     // Set up comment titles.
     $this->commentTitles = array('en' => 'Food in Paris', 'es' => 'Comida en Paris', 'fr' => 'Nouriture en Paris');
     // Create a new comment. Using the one created earlier will not work,
     // as it predates the language set-up.
     $comment = array('uid' => $this->loggedInUser->id(), 'entity_id' => $this->nodeUserCommented->id(), 'entity_type' => 'node', 'field_name' => 'comment', 'cid' => '', 'pid' => '', 'node_type' => '');
     $this->comment = Comment::create($comment);
     // Add field values and translate the comment.
     $this->comment->subject->value = $this->commentTitles['en'];
     $this->comment->comment_body->value = $this->commentTitles['en'];
     $this->comment->langcode = 'en';
     $this->comment->save();
     foreach (array('es', 'fr') as $langcode) {
         $translation = $this->comment->addTranslation($langcode, array());
         $translation->comment_body->value = $this->commentTitles[$langcode];
         $translation->subject->value = $this->commentTitles[$langcode];
     }
     $this->comment->save();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->addDefaultCommentField('node', 'page', $this->fieldName);
     $this->customComment = Comment::create(['entity_id' => $this->nodeUserCommented->id(), 'entity_type' => 'node', 'field_name' => $this->fieldName]);
     $this->customComment->save();
 }
 protected function setUp()
 {
     parent::setUp();
     // Add another anonymous comment.
     $comment = array('uid' => 0, 'entity_id' => $this->nodeUserCommented->id(), 'entity_type' => 'node', 'field_name' => 'comment', 'subject' => 'A lot, apparently', 'cid' => '', 'pid' => $this->comment->id(), 'mail' => '*****@*****.**', 'name' => 'bobby tables', 'hostname' => 'public.example.com');
     $this->comment = entity_create('comment', $comment);
     $this->comment->save();
 }