Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-09-28 22:00:38 +02:00
commit bc77943cae
3 changed files with 87 additions and 132 deletions

View File

@ -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)
);
}
}

View File

@ -1,57 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
** Test for PhpMyAdmin\Util::convertBitDefaultValue from common.lib
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
/**
** Test for PhpMyAdmin\Util::convertBitDefaultValue from common.lib
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
class PMA_ConvertBitDefaultValueTest extends PHPUnit_Framework_TestCase
{
/**
* Provider for testConvertBitDefaultValueTest
*
* @return array
*
* @dataProvider dataProvider
*/
public function dataProvider()
{
return array(
array("b'",""),
array("b'01'","01"),
array("b'010111010'","010111010")
);
}
/**
* Test for convertBitDefaultValue
*
* @param string $bit Value
* @param string $val Expected value
*
* @return void
*
* @dataProvider dataProvider
*/
public function testConvertBitDefaultValueTest($bit, $val)
{
$this->assertEquals(
$val, PhpMyAdmin\Util::convertBitDefaultValue($bit)
);
}
}

View File

@ -1,75 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for MySQL Wildcards escaping/unescaping
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
/*
* Include to test.
*/
/**
* Test for MySQL Wildcards escaping/unescaping
*
* @package PhpMyAdmin-test
* @group common.lib-tests
*/
class PMA_EscapeMySqlWildcardsTest extends PHPUnit_Framework_TestCase
{
/**
* data provider for testEscape and testUnEscape
*
* @return array
*/
public function escapeDataProvider()
{
return array(
array('\_test', '_test'),
array('\_\\', '_\\'),
array('\\_\%', '_%'),
array('\\\_', '\_'),
array('\\\_\\\%', '\_\%'),
array('\_\\%\_\_\%', '_%__%'),
array('\%\_', '%_'),
array('\\\%\\\_', '\%\_')
);
}
/**
* PhpMyAdmin\Util::escapeMysqlWildcards tests
*
* @param string $a String to escape
* @param string $b Expected value
*
* @return void
*
* @dataProvider escapeDataProvider
*/
public function testEscape($a, $b)
{
$this->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)
);
}
}