added testsuite for PMA_sanitize
This commit is contained in:
@@ -19,6 +19,7 @@ require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
require_once './test/FailTest.php';
|
||||
require_once './test/PMA_get_real_size_test.php';
|
||||
require_once './test/PMA_sanitize_test.php';
|
||||
|
||||
class AllTests
|
||||
{
|
||||
@@ -33,6 +34,7 @@ class AllTests
|
||||
|
||||
//$suite->addTestSuite('FailTest');
|
||||
$suite->addTestSuite('PMA_get_real_size_test');
|
||||
$suite->addTestSuite('PMA_sanitize_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
41
test/PMA_sanitize_test.php
Normal file
41
test/PMA_sanitize_test.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* tests for PMA_sanitize()
|
||||
*
|
||||
* @version $Id: $
|
||||
* @package phpMyAdmin-test
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once './libraries/sanitizing.lib.php';
|
||||
|
||||
class PMA_sanitize_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testXssInHref()
|
||||
{
|
||||
$this->assertEquals('<a href="" target="target">link</a>',
|
||||
PMA_sanitize('[a@javascript:alert(\'XSS\');@target]link[/a]'));
|
||||
}
|
||||
|
||||
public function testLink()
|
||||
{
|
||||
$this->assertEquals('<a href="http://www.phpmyadmin.net/" target="target">link</a>',
|
||||
PMA_sanitize('[a@http://www.phpmyadmin.net/@target]link[/a]'));
|
||||
}
|
||||
|
||||
public function testHtmlTags()
|
||||
{
|
||||
$this->assertEquals('<div onclick="">',
|
||||
PMA_sanitize('<div onclick="">'));
|
||||
}
|
||||
|
||||
public function testBbcoe()
|
||||
{
|
||||
$this->assertEquals('<strong>strong</strong>',
|
||||
PMA_sanitize('[b]strong[/b]'));
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user