2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * tests for PMA_sanitize()
7 * @package phpMyAdmin-test
13 require_once 'PHPUnit/Framework.php';
14 require_once './libraries/sanitizing.lib.php';
17 * @package phpMyAdmin-test
19 class PMA_sanitize_test
extends PHPUnit_Framework_TestCase
21 public function testXssInHref()
23 $this->assertEquals('[a@javascript:alert(\'XSS\');@target]link</a>',
24 PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]'));
27 public function testLink()
29 $this->assertEquals('<a href="http://www.phpmyadmin.net/" target="target">link</a>',
30 PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]'));
33 public function testHtmlTags()
35 $this->assertEquals('<div onclick="">',
36 PMA_sanitize('<div onclick="">'));
39 public function testBbcoe()
41 $this->assertEquals('<strong>strong</strong>',
42 PMA_sanitize('[b]strong[/b]'));