1 link.sanitize.test | public LinkSanitizeTest::testHtmlTitle() |
Test that unwanted HTML in titles is removed.
File
- core/
modules/ link/ tests/ link.sanitize.test, line 96 - Contains simpletests for sanitization.
Class
- LinkSanitizeTest
- Test for _link_sanitize().
Code
public function testHtmlTitle() {
$item['title'] = '<script>alert("hi");</script>';
$item['url'] = 'https://www.backdropcms.org/';
$item['html'] = TRUE;
list($field, $instance, $entity) = $this->generateParams();
// Disable the URL cutoff to confirm the URL.
$instance['settings']['display']['url_cutoff'] = FALSE;
_link_sanitize($item, 0, $field, $instance, $entity);
$this->assertEqual('alert("hi");', $item['title']);
}