Mercurial > hg > cmmr2012-drupal-site
diff core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
line wrap: on
line diff
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php Thu Feb 28 13:11:55 2019 +0000 +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php Thu May 09 15:34:47 2019 +0100 @@ -2,6 +2,7 @@ namespace Drupal\Tests\comment\Functional; +use Drupal\Core\Url; use Drupal\comment\CommentManagerInterface; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\comment\Entity\Comment; @@ -25,8 +26,8 @@ $this->drupalLogin($this->adminUser); // Make sure that comment field title is not displayed when there's no // comments posted. - $this->drupalGet($this->node->urlInfo()); - $this->assertNoPattern('@<h2[^>]*>Comments</h2>@', 'Comments title is not displayed.'); + $this->drupalGet($this->node->toUrl()); + $this->assertSession()->responseNotMatches('@<h2[^>]*>Comments</h2>@', 'Comments title is not displayed.'); // Set comments to have subject and preview disabled. $this->setCommentPreview(DRUPAL_DISABLED); @@ -48,7 +49,7 @@ $this->assertTrue($this->commentExists($comment), 'Comment found.'); // Test the comment field title is displayed when there's comments. - $this->drupalGet($this->node->urlInfo()); + $this->drupalGet($this->node->toUrl()); $this->assertPattern('@<h2[^>]*>Comments</h2>@', 'Comments title is displayed.'); // Set comments to have subject and preview to required. @@ -108,8 +109,8 @@ // Test changing the comment author to a verified user. $this->drupalGet('comment/' . $comment->id() . '/edit'); - $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => $this->webUser->getUsername() . ' (' . $this->webUser->id() . ')']); - $this->assertTrue($comment->getAuthorName() == $this->webUser->getUsername() && $comment->getOwnerId() == $this->webUser->id(), 'Comment author successfully changed to a registered user.'); + $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => $this->webUser->getAccountName() . ' (' . $this->webUser->id() . ')']); + $this->assertTrue($comment->getAuthorName() == $this->webUser->getAccountName() && $comment->getOwnerId() == $this->webUser->id(), 'Comment author successfully changed to a registered user.'); $this->drupalLogout(); @@ -120,7 +121,7 @@ // \Drupal\comment\Controller\CommentController::redirectNode(). $this->drupalGet('comment/' . $this->node->id() . '/reply'); // Verify we were correctly redirected. - $this->assertUrl(\Drupal::url('comment.reply', ['entity_type' => 'node', 'entity' => $this->node->id(), 'field_name' => 'comment'], ['absolute' => TRUE])); + $this->assertUrl(Url::fromRoute('comment.reply', ['entity_type' => 'node', 'entity' => $this->node->id(), 'field_name' => 'comment'], ['absolute' => TRUE])->toString()); $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id()); $this->assertText($subject_text, 'Individual comment-reply subject found.'); $this->assertText($comment_text, 'Individual comment-reply body found.');