Commit f85f7cf8 authored by webchick's avatar webchick

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

parent ba62c9c5
......@@ -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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment