Translation update done using Pootle.
[phpmyadmin/crack.git] / test / PMA_escapeJsString_test.php
blob4efd6337ef7856eb2a84ebf7e1b3406d9c0cde91
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for javascript escaping.
6 * @package phpMyAdmin-test
7 */
9 /**
10 * Tests core.
12 require_once 'PHPUnit/Framework.php';
14 /**
15 * Include to test.
17 require_once './libraries/js_escape.lib.php';
19 /**
20 * Test java script escaping.
22 * @package phpMyAdmin-test
24 class PMA_escapeJsString_test extends PHPUnit_Framework_TestCase
26 public function testEscape_1()
28 $this->assertEquals('\\\';', PMA_escapeJsString('\';'));
31 public function testEscape_2()
33 $this->assertEquals('\r\n\\\'<scrIpt></\' + \'script>', PMA_escapeJsString("\r\n'<scrIpt></sCRIPT>"));
36 public function testEscape_3()
38 $this->assertEquals('\\\';[XSS]', PMA_escapeJsString('\';[XSS]'));
41 public function testEscape_4()
43 $this->assertEquals('</\' + \'script></head><body>[HTML]', PMA_escapeJsString('</SCRIPT></head><body>[HTML]'));
46 public function testEscape_5()
48 $this->assertEquals('"\\\'\\\\\\\'"', PMA_escapeJsString('"\'\\\'"'));
51 public function testEscape_6()
53 $this->assertEquals("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", PMA_escapeJsString("\\''''''''''''\\"));