Chris@0: webUser = $this->drupalCreateUser([ Chris@0: 'access comments', Chris@0: 'post comments', Chris@0: 'create article content', Chris@0: 'edit own comments', Chris@0: 'node test view', Chris@0: 'skip comment approval', Chris@0: ]); Chris@0: Chris@0: // Set the author of the created node to the web_user uid. Chris@0: $this->node->setOwnerId($this->webUser->id())->save(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Test that threaded comments can be viewed. Chris@0: */ Chris@0: public function testThreadedCommentView() { Chris@0: // Set comments to have subject required and preview disabled. Chris@0: $this->drupalLogin($this->adminUser); Chris@0: $this->setCommentPreview(DRUPAL_DISABLED); Chris@0: $this->setCommentForm(TRUE); Chris@0: $this->setCommentSubject(TRUE); Chris@0: $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.'); Chris@0: $this->drupalLogout(); Chris@0: Chris@0: // Post comment. Chris@0: $this->drupalLogin($this->webUser); Chris@0: $comment_text = $this->randomMachineName(); Chris@0: $comment_subject = $this->randomMachineName(); Chris@0: $comment = $this->postComment($this->node, $comment_text, $comment_subject); Chris@0: $this->assertTrue($this->commentExists($comment), 'Comment found.'); Chris@0: Chris@0: // Check comment display. Chris@0: $this->drupalGet('node/' . $this->node->id()); Chris@0: $this->assertText($comment_subject, 'Individual comment subject found.'); Chris@0: $this->assertText($comment_text, 'Individual comment body found.'); Chris@0: Chris@0: // Reply to comment, creating second comment. Chris@0: $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id()); Chris@0: $reply_text = $this->randomMachineName(); Chris@0: $reply_subject = $this->randomMachineName(); Chris@0: $reply = $this->postComment(NULL, $reply_text, $reply_subject, TRUE); Chris@0: $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.'); Chris@0: Chris@0: // Go to the node page and verify comment and reply are visible. Chris@0: $this->drupalGet('node/' . $this->node->id()); Chris@0: $this->assertText($comment_text); Chris@0: $this->assertText($comment_subject); Chris@0: $this->assertText($reply_text); Chris@0: $this->assertText($reply_subject); Chris@0: } Chris@0: Chris@0: }