diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index 0e27d21de4..911594618f 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -22,7 +22,7 @@ require_once 'libraries/Message.class.php'; require_once 'libraries/Response.class.php'; require_once 'libraries/relation.lib.php'; require_once 'libraries/server_privileges.lib.php'; - +define("PMA_USR_BROWSER_AGENT", 1); /** * PMA_ServerPrivileges_Test class * @@ -57,12 +57,22 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb'; $GLOBALS['cfg']['Server']['usergroups'] = 'usergroups'; $GLOBALS['cfg']['Server']['users'] = 'users'; + $GLOBALS['cfg']['ActionLinksMode'] = "both"; + $GLOBALS['cfg']['DefaultTabDatabase'] = 'db_structure.php'; + $GLOBALS['cfg']['QueryWindowHeight'] = 100; + $GLOBALS['cfg']['QueryWindowWidth'] = 100; + $GLOBALS['cfg']['PmaAbsoluteUri'] = "PmaAbsoluteUri"; + $GLOBALS['cfg']['DefaultTabTable'] = "db_structure.php"; + $GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = "db_structure.php"; + $GLOBALS['cfg']['Confirm'] = "Confirm"; $GLOBALS['table'] = "table"; $GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF'); $GLOBALS['pmaThemeImage'] = 'image'; $GLOBALS['server'] = 1; $GLOBALS['username'] = "pma_username"; + $GLOBALS['collation_connection'] = "collation_connection"; + $GLOBALS['text_dir'] = "text_dir"; //$_POST $_POST['pred_password'] = 'none'; @@ -70,6 +80,12 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme'); $_SESSION['PMA_Theme'] = new PMA_Theme(); + $pmaconfig = $this->getMockBuilder('PMA_Config') + ->disableOriginalConstructor() + ->getMock(); + + $GLOBALS['PMA_Config'] = $pmaconfig; + //Mock DBI $dbi = $this->getMockBuilder('PMA_DatabaseInterface') ->disableOriginalConstructor() @@ -294,6 +310,38 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase } + /** + * Test for PMA_getHtmlForUserGroupDialog + * + * @return void + */ + public function testPMAGetHtmlForUserGroupDialog() + { + $username = "pma_username"; + $is_menuswork = true; + $_REQUEST['edit_user_group_dialog'] = "edit_user_group_dialog"; + $GLOBALS['is_ajax_request'] = false; + + //PMA_getHtmlForUserGroupDialog + $html = PMA_getHtmlForUserGroupDialog($username, $is_menuswork); + $this->assertContains( + '