function CommentAttributesTest::testCommentRdfaMarkup
Same name in other branches
- 8.9.x core/modules/rdf/tests/src/Functional/CommentAttributesTest.php \Drupal\Tests\rdf\Functional\CommentAttributesTest::testCommentRdfaMarkup()
Tests if RDFa markup for meta information is present in comments.
Tests presence of RDFa markup for the title, date and author and homepage on comments from registered and anonymous users.
File
-
core/
modules/ rdf/ tests/ src/ Functional/ CommentAttributesTest.php, line 185
Class
- CommentAttributesTest
- Tests the RDFa markup of comments.
Namespace
Drupal\Tests\rdf\FunctionalCode
public function testCommentRdfaMarkup() {
// Set to test the altered display name.
\Drupal::state()->set('user_hooks_test_user_format_name_alter', TRUE);
// Posts comment #1 on behalf of registered user.
$comment1 = $this->saveComment($this->node
->id(), $this->webUser
->id());
// Tests comment #1 with access to the user profile.
$this->drupalLogin($this->webUser);
$this->_testBasicCommentRdfaMarkup($comment1);
// Tests comment #1 with no access to the user profile (as anonymous user).
$this->drupalLogout();
$this->_testBasicCommentRdfaMarkup($comment1);
// Posts comment #2 as anonymous user.
$anonymous_user = [];
$anonymous_user['name'] = $this->randomMachineName();
$anonymous_user['mail'] = 'tester@simpletest.org';
$anonymous_user['homepage'] = 'http://example.org/';
$comment2 = $this->saveComment($this->node
->id(), 0, $anonymous_user);
$anonymous = User::load(0);
// Tests comment #2 as anonymous user.
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous);
// Tests comment #2 as logged in user.
$this->drupalLogin($this->webUser);
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.