function CommonXssUnitTest::testEscaping in Drupal 7
Check that special characters are escaped.
File
- modules/
simpletest/ tests/ common.test, line 500 - Tests for common.inc functionality.
Class
- CommonXssUnitTest
- Tests for check_plain(), filter_xss(), format_string(), and check_url().
Code
function testEscaping() {
$text = check_plain("<script>");
$this
->assertEqual($text, '<script>', 'check_plain() escapes <script>');
$text = check_plain('<>&"\'');
$this
->assertEqual($text, '<>&"'', 'check_plain() escapes reserved HTML characters.');
}