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
diff options
context:
space:
mode:
authorWilliam Desportes <williamdes@wdes.fr>2021-03-05 18:20:49 +0300
committerWilliam Desportes <williamdes@wdes.fr>2021-03-05 18:21:32 +0300
commit7943c8a4974dc50bf7fb53e3b1572f274ccc9c9e (patch)
tree9ce85595ee2e50e34e64cb420df8209ad17ef323 /test/classes/UtilTest.php
parentcfcb5c902ad8bacc88e52a6a692f8d9e436f561f (diff)
parente00c957e063ea2473adbe1de83775199f09c18a6 (diff)
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'test/classes/UtilTest.php')
-rw-r--r--test/classes/UtilTest.php173
1 files changed, 173 insertions, 0 deletions
diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php
index 5a81cde33a..f5b48578bc 100644
--- a/test/classes/UtilTest.php
+++ b/test/classes/UtilTest.php
@@ -2556,4 +2556,177 @@ class UtilTest extends AbstractTestCase
$this->assertFalse(Util::currentUserHasPrivilege('EVENT', 'my_data_base', 'my_data_table'));
$GLOBALS['dbi'] = $oldDbi;
}
+
+ /**
+ * @return array[]
+ */
+ public function dataProviderScriptNames(): array
+ {
+ // target
+ // location
+ // function output
+ return [
+ [
+ 'structure', // Notice the typo on db_structure.php
+ 'databasesss',
+ './',// Fallback to a relative path, impossible to build a valid route link
+ ],
+ [
+ 'db_structures.php', // Notice the typo on databases
+ 'database',
+ './',// Fallback to a relative path, impossible to build a valid route link
+ ],
+ [
+ 'tbl_structure.php', // Support the legacy value
+ 'table',
+ 'index.php?route=/table/structure&amp;lang=en',
+ ],
+ [
+ 'structure',
+ 'table',
+ 'index.php?route=/table/structure&amp;lang=en',
+ ],
+ [
+ 'tbl_sql.php', // Support the legacy value
+ 'table',
+ 'index.php?route=/table/sql&amp;lang=en',
+ ],
+ [
+ 'sql',
+ 'table',
+ 'index.php?route=/table/sql&amp;lang=en',
+ ],
+ [
+ 'tbl_select.php', // Support the legacy value
+ 'table',
+ 'index.php?route=/table/search&amp;lang=en',
+ ],
+ [
+ 'search',
+ 'table',
+ 'index.php?route=/table/search&amp;lang=en',
+ ],
+ [
+ 'tbl_change.php', // Support the legacy value
+ 'table',
+ 'index.php?route=/table/change&amp;lang=en',
+ ],
+ [
+ 'insert',
+ 'table',
+ 'index.php?route=/table/change&amp;lang=en',
+ ],
+ [
+ 'sql.php', // Support the legacy value
+ 'table',
+ 'index.php?route=/sql&amp;lang=en',
+ ],
+ [
+ 'browse',
+ 'table',
+ 'index.php?route=/sql&amp;lang=en',
+ ],
+ [
+ 'db_structure.php', // Support the legacy value
+ 'database',
+ 'index.php?route=/database/structure&amp;lang=en',
+ ],
+ [
+ 'structure',
+ 'database',
+ 'index.php?route=/database/structure&amp;lang=en',
+ ],
+ [
+ 'db_sql.php', // Support the legacy value
+ 'database',
+ 'index.php?route=/database/sql&amp;lang=en',
+ ],
+ [
+ 'sql',
+ 'database',
+ 'index.php?route=/database/sql&amp;lang=en',
+ ],
+ [
+ 'db_search.php', // Support the legacy value
+ 'database',
+ 'index.php?route=/database/search&amp;lang=en',
+ ],
+ [
+ 'search',
+ 'database',
+ 'index.php?route=/database/search&amp;lang=en',
+ ],
+ [
+ 'db_operations.php', // Support the legacy value
+ 'database',
+ 'index.php?route=/database/operations&amp;lang=en',
+ ],
+ [
+ 'operations',
+ 'database',
+ 'index.php?route=/database/operations&amp;lang=en',
+ ],
+ [
+ 'index.php', // Support the legacy value
+ 'server',
+ 'index.php?route=/&amp;lang=en',
+ ],
+ [
+ 'welcome',
+ 'server',
+ 'index.php?route=/&amp;lang=en',
+ ],
+ [
+ 'server_databases.php', // Support the legacy value
+ 'server',
+ 'index.php?route=/server/databases&amp;lang=en',
+ ],
+ [
+ 'databases',
+ 'server',
+ 'index.php?route=/server/databases&amp;lang=en',
+ ],
+ [
+ 'server_status.php', // Support the legacy value
+ 'server',
+ 'index.php?route=/server/status&amp;lang=en',
+ ],
+ [
+ 'status',
+ 'server',
+ 'index.php?route=/server/status&amp;lang=en',
+ ],
+ [
+ 'server_variables.php', // Support the legacy value
+ 'server',
+ 'index.php?route=/server/variables&amp;lang=en',
+ ],
+ [
+ 'variables',
+ 'server',
+ 'index.php?route=/server/variables&amp;lang=en',
+ ],
+ [
+ 'server_privileges.php', // Support the legacy value
+ 'server',
+ 'index.php?route=/server/privileges&amp;lang=en',
+ ],
+ [
+ 'privileges',
+ 'server',
+ 'index.php?route=/server/privileges&amp;lang=en',
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider dataProviderScriptNames
+ */
+ public function testGetScriptNameForOption(string $target, string $location, string $finalLink): void
+ {
+ $this->assertSame(
+ $finalLink,
+ Util::getScriptNameForOption($target, $location)
+ );
+ }
}