diff options
author | William Desportes <williamdes@wdes.fr> | 2021-03-05 18:20:49 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2021-03-05 18:21:32 +0300 |
commit | 7943c8a4974dc50bf7fb53e3b1572f274ccc9c9e (patch) | |
tree | 9ce85595ee2e50e34e64cb420df8209ad17ef323 /test/classes/UtilTest.php | |
parent | cfcb5c902ad8bacc88e52a6a692f8d9e436f561f (diff) | |
parent | e00c957e063ea2473adbe1de83775199f09c18a6 (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.php | 173 |
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&lang=en', + ], + [ + 'structure', + 'table', + 'index.php?route=/table/structure&lang=en', + ], + [ + 'tbl_sql.php', // Support the legacy value + 'table', + 'index.php?route=/table/sql&lang=en', + ], + [ + 'sql', + 'table', + 'index.php?route=/table/sql&lang=en', + ], + [ + 'tbl_select.php', // Support the legacy value + 'table', + 'index.php?route=/table/search&lang=en', + ], + [ + 'search', + 'table', + 'index.php?route=/table/search&lang=en', + ], + [ + 'tbl_change.php', // Support the legacy value + 'table', + 'index.php?route=/table/change&lang=en', + ], + [ + 'insert', + 'table', + 'index.php?route=/table/change&lang=en', + ], + [ + 'sql.php', // Support the legacy value + 'table', + 'index.php?route=/sql&lang=en', + ], + [ + 'browse', + 'table', + 'index.php?route=/sql&lang=en', + ], + [ + 'db_structure.php', // Support the legacy value + 'database', + 'index.php?route=/database/structure&lang=en', + ], + [ + 'structure', + 'database', + 'index.php?route=/database/structure&lang=en', + ], + [ + 'db_sql.php', // Support the legacy value + 'database', + 'index.php?route=/database/sql&lang=en', + ], + [ + 'sql', + 'database', + 'index.php?route=/database/sql&lang=en', + ], + [ + 'db_search.php', // Support the legacy value + 'database', + 'index.php?route=/database/search&lang=en', + ], + [ + 'search', + 'database', + 'index.php?route=/database/search&lang=en', + ], + [ + 'db_operations.php', // Support the legacy value + 'database', + 'index.php?route=/database/operations&lang=en', + ], + [ + 'operations', + 'database', + 'index.php?route=/database/operations&lang=en', + ], + [ + 'index.php', // Support the legacy value + 'server', + 'index.php?route=/&lang=en', + ], + [ + 'welcome', + 'server', + 'index.php?route=/&lang=en', + ], + [ + 'server_databases.php', // Support the legacy value + 'server', + 'index.php?route=/server/databases&lang=en', + ], + [ + 'databases', + 'server', + 'index.php?route=/server/databases&lang=en', + ], + [ + 'server_status.php', // Support the legacy value + 'server', + 'index.php?route=/server/status&lang=en', + ], + [ + 'status', + 'server', + 'index.php?route=/server/status&lang=en', + ], + [ + 'server_variables.php', // Support the legacy value + 'server', + 'index.php?route=/server/variables&lang=en', + ], + [ + 'variables', + 'server', + 'index.php?route=/server/variables&lang=en', + ], + [ + 'server_privileges.php', // Support the legacy value + 'server', + 'index.php?route=/server/privileges&lang=en', + ], + [ + 'privileges', + 'server', + 'index.php?route=/server/privileges&lang=en', + ], + ]; + } + + /** + * @dataProvider dataProviderScriptNames + */ + public function testGetScriptNameForOption(string $target, string $location, string $finalLink): void + { + $this->assertSame( + $finalLink, + Util::getScriptNameForOption($target, $location) + ); + } } |