function RevisionVersionHistoryTest::testDescriptionRevisionLogMessage
Same name in other branches
- 11.x core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php \Drupal\FunctionalTests\Entity\RevisionVersionHistoryTest::testDescriptionRevisionLogMessage()
Test revision log message if supported, and HTML tags are stripped.
@covers ::getRevisionDescription
File
-
core/
tests/ Drupal/ FunctionalTests/ Entity/ RevisionVersionHistoryTest.php, line 221
Class
- RevisionVersionHistoryTest
- Tests version history page.
Namespace
Drupal\FunctionalTests\EntityCode
public function testDescriptionRevisionLogMessage() : void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
$entity = EntityTestWithRevisionLog::create([
'type' => 'entity_test_revlog',
]);
$entity->setName('view all revisions');
$entity->setRevisionLogMessage('<em>Hello</em> <script>world</script> <strong>123</strong>');
$entity->save();
$this->drupalGet($entity->toUrl('version-history'));
// Script tags are stripped, while admin-safe tags are retained.
$this->assertSession()
->elementContains('css', 'table tbody tr:nth-child(1)', '<em>Hello</em> world <strong>123</strong>');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.