diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 0871ad7951..59bd30c694 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -581,4 +581,91 @@ class UtilTest extends \PMATestCase array("chars%$\r\n", 1), ); } + + /** + * Test for Util::convertBitDefaultValue + * + * @param string $bit Value + * @param string $val Expected value + * + * @return void + * + * @covers PhpMyAdmin\Util::convertBitDefaultValue + * @dataProvider providerConvertBitDefaultValue + */ + public function testConvertBitDefaultValue($bit, $val) + { + $this->assertEquals( + $val, Util::convertBitDefaultValue($bit) + ); + } + + /** + * Provider for testConvertBitDefaultValue + * + * @return array + */ + public function providerConvertBitDefaultValue() + { + return array( + array("b'",""), + array("b'01'","01"), + array("b'010111010'","010111010") + ); + } + + /** + * data provider for testEscapeMysqlWildcards and testUnescapeMysqlWildcards + * + * @return array + */ + public function providerUnEscapeMysqlWildcards() + { + return array( + array('\_test', '_test'), + array('\_\\', '_\\'), + array('\\_\%', '_%'), + array('\\\_', '\_'), + array('\\\_\\\%', '\_\%'), + array('\_\\%\_\_\%', '_%__%'), + array('\%\_', '%_'), + array('\\\%\\\_', '\%\_') + ); + } + + /** + * PhpMyAdmin\Util::escapeMysqlWildcards tests + * + * @param string $a Expected value + * @param string $b String to escape + * + * @return void + * + * @covers PhpMyAdmin\Util::escapeMysqlWildcards + * @dataProvider providerUnEscapeMysqlWildcards + */ + public function testEscapeMysqlWildcards($a, $b) + { + $this->assertEquals( + $a, Util::escapeMysqlWildcards($b) + ); + } + + /** + * PhpMyAdmin\Util::unescapeMysqlWildcards tests + * + * @param string $a String to unescape + * @param string $b Expected value + * + * @return void + * + * @covers PhpMyAdmin\Util::unescapeMysqlWildcards + * @dataProvider providerUnEscapeMysqlWildcards + */ + public function testUnescapeMysqlWildcards($a, $b) + { + $this->assertEquals( + $b, Util::unescapeMysqlWildcards($a) + ); + } } diff --git a/test/libraries/common/PMA_convert_bit_default_value_test.php b/test/libraries/common/PMA_convert_bit_default_value_test.php deleted file mode 100644 index 0d013323e6..0000000000 --- a/test/libraries/common/PMA_convert_bit_default_value_test.php +++ /dev/null @@ -1,57 +0,0 @@ -assertEquals( - $val, PhpMyAdmin\Util::convertBitDefaultValue($bit) - ); - - } -} diff --git a/test/libraries/common/PMA_escapeMySqlWildcards_test.php b/test/libraries/common/PMA_escapeMySqlWildcards_test.php deleted file mode 100644 index 7a9777c36d..0000000000 --- a/test/libraries/common/PMA_escapeMySqlWildcards_test.php +++ /dev/null @@ -1,75 +0,0 @@ -assertEquals( - $a, PhpMyAdmin\Util::escapeMysqlWildcards($b) - ); - } - - /** - * PhpMyAdmin\Util::unescapeMysqlWildcards tests - * - * @param string $a String to escape - * @param string $b Expected value - * - * @return void - * - * @dataProvider escapeDataProvider - */ - public function testUnEscape($a, $b) - { - $this->assertEquals( - $b, PhpMyAdmin\Util::unescapeMysqlWildcards($a) - ); - } -}