Translation update done using Pootle.
[phpmyadmin/ammaryasirr.git] / test / libraries / PMA_escapeJsString_test.php
blob93afaef77526e81afa8c54bf473264f0eff3d4d0
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 * Include to test.
12 require_once 'libraries/js_escape.lib.php';
14 class PMA_escapeJsString_test extends PHPUnit_Framework_TestCase
16 /**
17 * PMA_escapeJsString tests
18 * @dataProvider escapeDataProvider
20 public function testEscape($target, $source)
22 $this->assertEquals($target, PMA_escapeJsString($source));
25 public function escapeDataProvider() {
26 return array(
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("\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", "\\''''''''''''\\")