Chris@0: drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); Chris@0: // Add a comment field. Chris@0: $this->addDefaultCommentField('node', 'page'); Chris@0: Chris@0: $permissions = ['access comments', 'create page content', 'post comments', 'skip comment approval']; Chris@0: $account = $this->drupalCreateUser($permissions); Chris@0: Chris@0: $this->drupalLogin($account); Chris@0: Chris@0: $this->node = $this->drupalCreateNode([ Chris@0: 'title' => $this->randomMachineName(8), Chris@0: 'uid' => $account->id(), Chris@0: 'status' => 1, Chris@0: ]); Chris@0: Chris@0: $this->comment = Comment::create([ Chris@0: 'entity_id' => $this->node->id(), Chris@0: 'entity_type' => 'node', Chris@0: 'field_name' => 'comment', Chris@0: 'subject' => $this->randomMachineName(), Chris@0: 'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomMachineName(20), Chris@0: ]); Chris@0: Chris@0: } Chris@0: Chris@0: }