From 83ed68258f805aefb040586d7d24540f1d131d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 28 Sep 2017 16:33:24 -0300 Subject: [PATCH 1/2] Refactor PMA_convert_bit_default_value_test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move PMA_convert_bit_default_value_test to UtilTest Signed-off-by: MaurĂ­cio Meneghini Fauth --- test/classes/UtilTest.php | 32 +++++++++++ .../PMA_convert_bit_default_value_test.php | 57 ------------------- 2 files changed, 32 insertions(+), 57 deletions(-) delete mode 100644 test/libraries/common/PMA_convert_bit_default_value_test.php diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 0871ad7951..7370142398 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -581,4 +581,36 @@ 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") + ); + } } 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) - ); - - } -} From f48244c1bd72a2bbb5cf4376f960235e9b858336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 28 Sep 2017 16:43:31 -0300 Subject: [PATCH 2/2] Refactor PMA_escapeMySqlWildcards_test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move PMA_escapeMySqlWildcards_test to UtilTest Signed-off-by: MaurĂ­cio Meneghini Fauth --- test/classes/UtilTest.php | 55 ++++++++++++++ .../common/PMA_escapeMySqlWildcards_test.php | 75 ------------------- 2 files changed, 55 insertions(+), 75 deletions(-) delete mode 100644 test/libraries/common/PMA_escapeMySqlWildcards_test.php diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 7370142398..59bd30c694 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -613,4 +613,59 @@ class UtilTest extends \PMATestCase 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_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) - ); - } -}