1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for MySQL Wildcards escaping/unescaping
*
* @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
{
public function escapeDataProvider() {
return array(
array('\_test', '_test'),
array('\_\\', '_\\'),
array('\\_\%', '_%'),
array('\\\_', '\_'),
array('\\\_\\\%', '\_\%'),
array('\_\\%\_\_\%', '_%__%'),
array('\%\_', '%_'),
array('\\\%\\\_', '\%\_')
);
}
/**
* PMA_escape_mysql_wildcards tests
* @dataProvider escapeDataProvider
*/
public function testEscape($a, $b)
{
$this->assertEquals($a, PMA_escape_mysql_wildcards($b));
}
/**
* PMA_unescape_mysql_wildcards tests
* @dataProvider escapeDataProvider
*/
public function testUnEscape($a, $b)
{
$this->assertEquals($b, PMA_unescape_mysql_wildcards($a));
}
}
?>
|