diff --git a/test/AllTests.php b/test/AllTests.php index 04ab60e3b..8c2cf9c9d 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -34,8 +34,8 @@ require_once './test/PMA_isValid_test.php'; require_once './test/PMA_transformation_getOptions_test.php'; require_once './test/PMA_STR_sub_test.php'; require_once './test/PMA_generateCommonUrl_test.php'; -//require_once './test/PMA_arrayWalkRecursive_test.php'; require_once './test/PMA_blowfish_test.php'; +require_once './test/PMA_escapeMySqlWildcards_test.php'; class AllTests { diff --git a/test/PMA_STR_sub_test.php b/test/PMA_STR_sub_test.php index ee54aae3c..0ed9de428 100644 --- a/test/PMA_STR_sub_test.php +++ b/test/PMA_STR_sub_test.php @@ -3,7 +3,7 @@ /** * tests for PMA_pow() * - * @version $Id: PMA_pow_test.php 10140 2007-03-20 08:32:55Z cybot_tm $ + * @version $Id$ * @package phpMyAdmin-test */ diff --git a/test/PMA_blowfish_test.php b/test/PMA_blowfish_test.php index aa52a465f..9d7657b03 100644 --- a/test/PMA_blowfish_test.php +++ b/test/PMA_blowfish_test.php @@ -4,7 +4,7 @@ * Test for blowfish encryption. * * @package phpMyAdmin-test - * @version $Id: PMA_escapeJsString_test.php 10237 2007-04-01 08:23:23Z cybot_tm $ + * @version $Id$ */ /** diff --git a/test/PMA_escapeMySqlWildcards_test.php b/test/PMA_escapeMySqlWildcards_test.php new file mode 100644 index 000000000..289067c4b --- /dev/null +++ b/test/PMA_escapeMySqlWildcards_test.php @@ -0,0 +1,86 @@ + + * @package phpMyAdmin-test + * @version $Id$ + */ + +/** + * Tests core. + */ +require_once 'PHPUnit/Framework.php'; + +/** + * Include to test. + */ +require_once './libraries/common.lib.php'; + +/** + * Test MySQL escaping. + * + */ +class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase +{ + + /** + * PMA_escape_mysql_wildcards tests + */ + + public function testEscape_1() + { + $this->assertEquals('\_test', PMA_escape_mysql_wildcards('_test')); + } + + public function testEscape_2() + { + $this->assertEquals('\_\\', PMA_escape_mysql_wildcards('_\\')); + } + + public function testEscape_3() + { + $this->assertEquals('\\_\%', PMA_escape_mysql_wildcards('_%')); + } + + public function testEscape_4() + { + $this->assertEquals('\\\_', PMA_escape_mysql_wildcards('\_')); + } + + public function testEscape_5() + { + $this->assertEquals('\\\_\\\%', PMA_escape_mysql_wildcards('\_\%')); + } + + /** + * PMA_unescape_mysql_wildcards tests + */ + + public function testUnEscape_1() + { + $this->assertEquals('_test', PMA_unescape_mysql_wildcards('\_test')); + } + + public function testUnEscape_2() + { + $this->assertEquals('_%__%', PMA_unescape_mysql_wildcards('\_\\%\_\_\%')); + } + + public function testUnEscape_3() + { + $this->assertEquals('\_', PMA_unescape_mysql_wildcards('\\\_')); + } + + public function testUnEscape_4() + { + $this->assertEquals('%_', PMA_unescape_mysql_wildcards('%\_')); + } + + public function testUnEscape_5() + { + $this->assertEquals('\%\_', PMA_unescape_mysql_wildcards('\\\%\\\_')); + } +} +?> diff --git a/test/PMA_generateCommonUrl_test.php b/test/PMA_generateCommonUrl_test.php index 3365506a6..e724924d4 100644 --- a/test/PMA_generateCommonUrl_test.php +++ b/test/PMA_generateCommonUrl_test.php @@ -3,7 +3,7 @@ /** * tests for PMA_generate_common_url() * - * @version $Id: PMA_get_real_size_test.php 10146 2007-03-20 14:16:18Z cybot_tm $ + * @version $Id$ * @package phpMyAdmin-test */ diff --git a/test/PMA_isValid_test.php b/test/PMA_isValid_test.php index 93621d539..e33deaed3 100644 --- a/test/PMA_isValid_test.php +++ b/test/PMA_isValid_test.php @@ -3,7 +3,7 @@ /** * tests for PMA_pow() * - * @version $Id: PMA_pow_test.php 10140 2007-03-20 08:32:55Z cybot_tm $ + * @version $Id$ * @package phpMyAdmin-test */ diff --git a/test/PMA_transformation_getOptions_test.php b/test/PMA_transformation_getOptions_test.php index 2fd96a335..dba3f6b09 100644 --- a/test/PMA_transformation_getOptions_test.php +++ b/test/PMA_transformation_getOptions_test.php @@ -3,7 +3,7 @@ /** * tests for PMA_sanitize() * - * @version $Id: PMA_sanitize_test.php 10140 2007-03-20 08:32:55Z cybot_tm $ + * @version $Id$ * @package phpMyAdmin-test */