Merge branch 'QA_3_3'
[phpmyadmin/dkf.git] / test / PMA_escapeMySqlWildcards_test.php
blob75dd4e837c834f3898c73ee0f227ff78221f15ff
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for MySQL Wildcards escaping/unescaping
6 * @package phpMyAdmin-test
7 * @version $Id$
8 */
10 /**
11 * Tests core.
13 require_once 'PHPUnit/Framework.php';
15 /**
16 * Include to test.
18 require_once './libraries/common.lib.php';
20 /**
21 * Test MySQL escaping.
24 class PMA_escapeMySqlWildcards_test extends PHPUnit_Framework_TestCase
27 public function escapeDataProvider() {
28 return array(
29 array('\_test', '_test'),
30 array('\_\\', '_\\'),
31 array('\\_\%', '_%'),
32 array('\\\_', '\_'),
33 array('\\\_\\\%', '\_\%'),
34 array('\_\\%\_\_\%', '_%__%'),
35 array('\%\_', '%_'),
36 array('\\\%\\\_', '\%\_')
40 /**
41 * PMA_escape_mysql_wildcards tests
42 * @dataProvider escapeDataProvider
45 public function testEscape($a, $b)
47 $this->assertEquals($a, PMA_escape_mysql_wildcards($b));
50 /**
51 * PMA_unescape_mysql_wildcards tests
52 * @dataProvider escapeDataProvider
55 public function testUnEscape($a, $b)
57 $this->assertEquals($b, PMA_unescape_mysql_wildcards($a));