Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / comment / tests / src / Functional / CommentTitleTest.php
similarity index 85%
rename from web/core/modules/comment/src/Tests/CommentTitleTest.php
rename to web/core/modules/comment/tests/src/Functional/CommentTitleTest.php
index 30d39357bace059bad4f49c09c8700ba4612b78f..65c4937e39ea324a0d177d8096cb2be112ea051e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\comment\Tests;
+namespace Drupal\Tests\comment\Functional;
 
 /**
  * Tests to ensure that appropriate and accessible markup is created for comment
@@ -29,6 +29,12 @@ class CommentTitleTest extends CommentTestBase {
     $subject_text = $this->randomMachineName();
     $comment_text = $this->randomMachineName();
     $comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
+
+    // The entity fields for name and mail have no meaning if the user is not
+    // Anonymous.
+    $this->assertNull($comment->name->value);
+    $this->assertNull($comment->mail->value);
+
     // Confirm that the comment was created.
     $regex = '/<a id="comment-' . $comment->id() . '"(.*?)';
     $regex .= $comment->comment_body->value . '(.*?)';
@@ -55,13 +61,19 @@ class CommentTitleTest extends CommentTestBase {
     $subject_text = $this->randomMachineName();
     $comment_text = $this->randomMachineName();
     $comment1 = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
+
+    // The entity fields for name and mail have no meaning if the user is not
+    // Anonymous.
+    $this->assertNull($comment1->name->value);
+    $this->assertNull($comment1->mail->value);
+
     // Confirm that the comment was created.
     $this->assertTrue($this->commentExists($comment1), 'Comment #1. Comment found.');
     // Tests that markup is created for comment with heading.
     $this->assertPattern('|<h3[^>]*><a[^>]*>' . $subject_text . '</a></h3>|', 'Comment title is rendered in h3 when title populated.');
     // Tests that the comment's title link is the permalink of the comment.
     $comment_permalink = $this->cssSelect('.permalink');
-    $comment_permalink = (string) $comment_permalink[0]['href'];
+    $comment_permalink = $comment_permalink[0]->getAttribute('href');
     // Tests that the comment's title link contains the url fragment.
     $this->assertTrue(strpos($comment_permalink, '#comment-' . $comment1->id()), "The comment's title link contains the url fragment.");
     $this->assertEqual($comment1->permalink()->toString(), $comment_permalink, "The comment's title has the correct link.");