Skip to content
Snippets Groups Projects
Commit f85f7cf8 authored by Angie Byron's avatar Angie Byron
Browse files

#349237 by c960657: Fix assertTitle()'s encoding of HTML attributes (with tests).

parent ba62c9c5
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -501,6 +501,8 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
$node = $this->drupalCreateNode($edit);
$this->drupalGet('node/' . $node->nid);
// assertTitle() decodes HTML-entities inside the <title> element.
$this->assertTitle($edit['title'] . ' | Drupal', t('Title is diplayed when viewing a node.'));
$this->assertNoRaw($xss, t('Harmful tags are escaped when viewing a node.'));
$this->drupalGet('node/' . $node->nid . '/edit');
......
......@@ -1821,7 +1821,7 @@ protected function assertNoPattern($pattern, $message = 'Pattern %s not found',
* TRUE on pass, FALSE on fail.
*/
protected function assertTitle($title, $message, $group = 'Other') {
return $this->assertTrue($this->xpath('//title[text()="' . $title . '"]'), $message, $group);
return $this->assertEqual(current($this->xpath('//title')), $title, $message, $group);
}
/**
......@@ -1837,7 +1837,7 @@ protected function assertTitle($title, $message, $group = 'Other') {
* TRUE on pass, FALSE on fail.
*/
protected function assertNoTitle($title, $message, $group = 'Other') {
return $this->assertFalse($this->xpath('//title[text()="' . $title . '"]'), $message, $group);
return $this->assertNotEqual(current($this->xpath('//title')), $title, $message, $group);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment