Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauricio@fauth.dev>2021-11-11 01:15:37 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2021-11-11 01:33:09 +0300
commita835d7cfccaaffa78b8c8b22204b5c6dcf8f4039 (patch)
tree35d8e93b035e91515714fd3e0b05cc1fbad14246 /test
parentfc01048c2edc09dd1800b8eed1786ac8fe6c88fd (diff)
Remove array support from `Util::backquote`
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r--test/classes/UtilTest.php113
1 files changed, 24 insertions, 89 deletions
diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php
index 7882829c4c..7c645610e7 100644
--- a/test/classes/UtilTest.php
+++ b/test/classes/UtilTest.php
@@ -1593,122 +1593,57 @@ class UtilTest extends AbstractTestCase
}
/**
- * backquote test with different param $do_it (true, false)
- *
- * @param string|array $a String
- * @param string|array $b Expected output
- *
- * @dataProvider providerBackquote
+ * @dataProvider providerForTestBackquote
*/
- public function testBackquote($a, $b): void
+ public function testBackquote(?string $entry, string $expectedNoneOutput, string $expectedMssqlOutput): void
{
- $this->assertEquals($b, Util::backquote($a));
+ $this->assertSame($expectedNoneOutput, Util::backquote($entry));
+ $this->assertEquals($entry, Util::backquoteCompat($entry, 'NONE', false));
+ $this->assertEquals($entry, Util::backquoteCompat($entry, 'MSSQL', false));
+ $this->assertSame($expectedNoneOutput, Util::backquoteCompat($entry, 'NONE'));
+ $this->assertSame($expectedMssqlOutput, Util::backquoteCompat($entry, 'MSSQL'));
}
/**
- * data provider for backquote test
- *
- * @return array
+ * @return array<int|string, string|null>[]
*/
- public function providerBackquote(): array
+ public function providerForTestBackquote(): array
{
return [
[
'0',
'`0`',
+ '"0"',
],
[
'test',
'`test`',
+ '"test"',
],
[
'te`st',
'`te``st`',
+ '"te`st"',
],
[
- [
- 'test',
- 'te`st',
- '',
- '*',
- ],
- [
- '`test`',
- '`te``st`',
- '',
- '*',
- ],
- ],
- ];
- }
-
- /**
- * backquoteCompat test with different param $compatibility (NONE, MSSQL)
- *
- * @param string|array $entry String
- * @param string|array $expectedNoneOutput Expected none output
- * @param string|array $expectedMssqlOutput Expected MSSQL output
- *
- * @dataProvider providerBackquoteCompat
- */
- public function testBackquoteCompat($entry, $expectedNoneOutput, $expectedMssqlOutput): void
- {
- // Test bypass quoting (used by dump functions)
- $this->assertEquals($entry, Util::backquoteCompat($entry, 'NONE', false));
-
- // Run tests in MSSQL compatibility mode
- // Test bypass quoting (used by dump functions)
- $this->assertEquals($entry, Util::backquoteCompat($entry, 'MSSQL', false));
-
- // Test backquote
- $this->assertEquals($expectedNoneOutput, Util::backquoteCompat($entry, 'NONE'));
-
- // Test backquote
- $this->assertEquals($expectedMssqlOutput, Util::backquoteCompat($entry, 'MSSQL'));
- }
-
- /**
- * data provider for backquoteCompat test
- *
- * @return array
- */
- public function providerBackquoteCompat(): array
- {
- return [
- [
- '0',
- '`0`',
- '"0"',
+ 'te"st',
+ '`te"st`',
+ '"te\"st"',
],
[
- 'test',
- '`test`',
- '"test"',
+ '',
+ '',
+ '',
],
[
- 'te`st',
- '`te``st`',
- '"te`st"',
+ '*',
+ '*',
+ '*',
],
[
- [
- 'test',
- 'te`st',
- '',
- '*',
- ],
- [
- '`test`',
- '`te``st`',
- '',
- '*',
- ],
- [
- '"test"',
- '"te`st"',
- '',
- '*',
- ],
+ null,
+ '',
+ '',
],
];
}