function CommentAttributesTest::testCommentRdfAuthorMarkup

Same name in other branches
  1. 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 151

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->assertLinkByHref('user/' . $this->webUser
        ->id());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.