2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Test for javascript escaping.
6 * @package phpMyAdmin-test
12 require_once 'libraries/js_escape.lib.php';
14 class PMA_escapeJsString_test
extends PHPUnit_Framework_TestCase
17 * PMA_escapeJsString tests
18 * @dataProvider escapeDataProvider
20 public function testEscape($target, $source)
22 $this->assertEquals($target, PMA_escapeJsString($source));
25 public function escapeDataProvider() {
27 array('\\\';', '\';'),
28 array('\r\n\\\'<scrIpt></\' + \'script>', "\r\n'<scrIpt></sCRIPT>"),
29 array('\\\';[XSS]', '\';[XSS]'),
30 array('</\' + \'script></head><body>[HTML]', '</SCRIPT></head><body>[HTML]'),
31 array('\"\\\'\\\\\\\'\"', '"\'\\\'"'),
32 array("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", "\\''''''''''''\\")