3.3.9.1 release
[phpmyadmin/crack.git] / test / PMA_escapeMySqlWildcards_test.php
blob54273fcd8da6d885e100764046861b514f5fc39d
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for MySQL Wildcards escaping/unescaping
6 * @author Michal Biniek <michal@bystrzyca.pl>
7 * @package phpMyAdmin-test
8 * @version $Id$
9 */
11 /**
12 * Tests core.
14 require_once 'PHPUnit/Framework.php';
16 /**
17 * Include to test.
19 require_once './libraries/common.lib.php';
21 /**
22 * Test MySQL escaping.
25 class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
28 public function escapeDataProvider() {
29 return array(
30 array('\_test', '_test'),
31 array('\_\\', '_\\'),
32 array('\\_\%', '_%'),
33 array('\\\_', '\_'),
34 array('\\\_\\\%', '\_\%'),
35 array('\_\\%\_\_\%', '_%__%'),
36 array('\%\_', '%_'),
37 array('\\\%\\\_', '\%\_')
41 /**
42 * PMA_escape_mysql_wildcards tests
43 * @dataProvider escapeDataProvider
46 public function testEscape($a, $b)
48 $this->assertEquals($a, PMA_escape_mysql_wildcards($b));
51 /**
52 * PMA_unescape_mysql_wildcards tests
53 * @dataProvider escapeDataProvider
56 public function testUnEscape($a, $b)
58 $this->assertEquals($b, PMA_unescape_mysql_wildcards($a));