bug #2931216 Relations settings not updated on config change
[phpmyadmin/dkf.git] / test / PMA_escapeJsString_test.php
blob350ce371c9ee3b58a92d39027c509fd86c5c4f52
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for javascript escaping.
6 * @author Michal Čihař <michal@cihar.com>
7 * @package phpMyAdmin-test
8 * @version $Id$
9 */
11 /**
12 * Tests core.
14 require_once 'PHPUnit/Framework.php';
16 /**
17 * Include to test.
19 require_once './libraries/js_escape.lib.php';
21 /**
22 * Test java script escaping.
24 * @package phpMyAdmin-test
26 class PMA_escapeJsString_test extends PHPUnit_Framework_TestCase
28 public function testEscape_1()
30 $this->assertEquals('\\\';', PMA_escapeJsString('\';'));
33 public function testEscape_2()
35 $this->assertEquals('\r\n\\\'<scrIpt></\' + \'script>', PMA_escapeJsString("\r\n'<scrIpt></sCRIPT>"));
38 public function testEscape_3()
40 $this->assertEquals('\\\';[XSS]', PMA_escapeJsString('\';[XSS]'));
43 public function testEscape_4()
45 $this->assertEquals('</\' + \'script></head><body>[HTML]', PMA_escapeJsString('</SCRIPT></head><body>[HTML]'));
48 public function testEscape_5()
50 $this->assertEquals('"\\\'\\\\\\\'"', PMA_escapeJsString('"\'\\\'"'));
53 public function testEscape_6()
55 $this->assertEquals("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", PMA_escapeJsString("\\''''''''''''\\"));