You are here

public function CommentAttributesTest::testCommentRdfAuthorMarkup in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rdf/tests/src/Functional/CommentAttributesTest.php \Drupal\Tests\rdf\Functional\CommentAttributesTest::testCommentRdfAuthorMarkup()
  2. 9 core/modules/rdf/tests/src/Functional/CommentAttributesTest.php \Drupal\Tests\rdf\Functional\CommentAttributesTest::testCommentRdfAuthorMarkup()

Tests comment author link markup has not been broken by RDF.

File

core/modules/rdf/tests/src/Functional/CommentAttributesTest.php, line 157

Class

CommentAttributesTest
Tests the RDFa markup of comments.

Namespace

Drupal\Tests\rdf\Functional

Code

public function testCommentRdfAuthorMarkup() {

  // Set to test the altered display name.
  \Drupal::state()
    ->set('user_hooks_test_user_format_name_alter', TRUE);

  // Post a comment as a registered user.
  $this
    ->saveComment($this->node
    ->id(), $this->webUser
    ->id());

  // Give the user access to view user profiles so the profile link shows up.
  user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, [
    'access user profiles',
  ]);
  $this
    ->drupalLogin($this->webUser);

  // Ensure that the author link still works properly after the author output
  // is modified by the RDF module.
  $this
    ->drupalGet('node/' . $this->node
    ->id());
  $this
    ->assertSession()
    ->linkExistsExact($this->webUser
    ->getDisplayName());
  $this
    ->assertSession()
    ->linkByHrefExists('user/' . $this->webUser
    ->id());
}