From ea0ad9d41c1726a573d6c0beeba7eec5cfa147c7 Mon Sep 17 00:00:00 2001 From: Sampath Liyanage Date: Mon, 27 Jan 2014 21:53:36 +0530 Subject: [PATCH] unit tests updated. Some global variables were set in setup functions of some test files. one testing function with mockobjects was changed from once() to exactly(2) because the bug fix has made that function calls twice Signed-off-by: Sampath Liyanage --- test/classes/PMA_Header_test.php | 1 + test/libraries/PMA_insert_edit_test.php | 3 +++ test/libraries/PMA_server_binlog_test.php | 9 ++++++--- test/libraries/PMA_server_privileges_test.php | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/classes/PMA_Header_test.php b/test/classes/PMA_Header_test.php index 04f194b390..78ae08ce4a 100644 --- a/test/classes/PMA_Header_test.php +++ b/test/classes/PMA_Header_test.php @@ -55,6 +55,7 @@ class PMA_Header_Test extends PHPUnit_Framework_TestCase $GLOBALS['PMA_Config']->enableBc(); $GLOBALS['cfg']['Server']['verbose'] = 'verbose host'; $GLOBALS['cfg']['Server']['pmadb'] = ''; + $GLOBALS['default_query'] = true; } /** diff --git a/test/libraries/PMA_insert_edit_test.php b/test/libraries/PMA_insert_edit_test.php index 2a27bfb9ae..77df46a43f 100644 --- a/test/libraries/PMA_insert_edit_test.php +++ b/test/libraries/PMA_insert_edit_test.php @@ -50,6 +50,9 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase $GLOBALS['text_dir'] = 'ltr'; $GLOBALS['db'] = 'db'; $GLOBALS['table'] = 'table'; + $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb'; + $GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs'; + $GLOBALS['cfg']['Server']['user'] = 'user'; } /** diff --git a/test/libraries/PMA_server_binlog_test.php b/test/libraries/PMA_server_binlog_test.php index 66d6304138..36daed383a 100644 --- a/test/libraries/PMA_server_binlog_test.php +++ b/test/libraries/PMA_server_binlog_test.php @@ -51,10 +51,13 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['ShowSQL'] = true; $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons'; $GLOBALS['cfg']['LimitChars'] = 100; - + $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb'; + $GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs'; + $GLOBALS['cfg']['Server']['user'] = 'user'; + $GLOBALS['table'] = "table"; $GLOBALS['pmaThemeImage'] = 'image'; - + //$_SESSION $_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme'); $_SESSION['PMA_Theme'] = new PMA_Theme(); @@ -138,7 +141,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase $count = 3; //expects functions - $dbi->expects($this->once())->method('query') + $dbi->expects($this->exactly(2))->method('query') ->will($this->returnValue($result)); $dbi->expects($this->once())->method('numRows') diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index 6b69d28ba1..1562879d76 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -65,6 +65,8 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = "db_structure.php"; $GLOBALS['cfg']['Confirm'] = "Confirm"; $GLOBALS['cfg']['ShowHint'] = true; + $GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs'; + $GLOBALS['cfg']['Server']['user'] = 'user'; $GLOBALS['cfgRelation'] = array(); $GLOBALS['cfgRelation']['menuswork'] = false; @@ -76,6 +78,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $GLOBALS['username'] = "username"; $GLOBALS['collation_connection'] = "collation_connection"; $GLOBALS['text_dir'] = "text_dir"; + $GLOBALS['default_query'] = true; //$_POST $_POST['pred_password'] = 'none';