Skip to content

Commit

Permalink
Add tests for #16713 and #16698
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Mar 5, 2021
1 parent 8da837a commit d08ddac
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/classes/UtilTest.php
Expand Up @@ -2600,4 +2600,38 @@ public function testCurrentUserHasNotUserPrivilegeAndNotDbPrivilegeAndNotTablePr
$this->assertFalse(Util::currentUserHasPrivilege('EVENT', 'my_data_base', 'my_data_table'));
$GLOBALS['dbi'] = $oldDbi;
}

public function testGetScriptNameForOption(): void
{
$this->assertEquals(
'./',
Util::getScriptNameForOption('db_structures.php', 'database'), // Notice the typo on db_structure.php
'Fallback to a relative path, impossible to build a valid route link'
);
$this->assertEquals(
'index.php?route=/database/structure&amp;lang=en',
Util::getScriptNameForOption('db_structure.php', 'database'),
'Support the legacy value for database'
);
$this->assertEquals(
'index.php?route=/table/structure&amp;lang=en',
Util::getScriptNameForOption('tbl_structure.php', 'table'),
'Support the legacy value for table'
);
$this->assertEquals(
'index.php?route=/server/status&amp;lang=en',
Util::getScriptNameForOption('server_status.php', 'server'),
'Support the legacy value for server'
);
$this->assertEquals(
'index.php?route=/database/structure&amp;lang=en',
Util::getScriptNameForOption('structure', 'database'),
'The new value to go to database structure'
);
$this->assertEquals(
'./',
Util::getScriptNameForOption('structure', 'databasesss'), // Notice the typo on databases
'Fallback to a relative path, impossible to build a valid route link'
);
}
}

0 comments on commit d08ddac

Please sign in to comment.