Merge pull request #489 from xmujay/0706_UT_serverview

using returnValueMap to fix different setting of PMA_DRIZZLE
This commit is contained in:
Michal Čihař 2013-07-09 23:59:39 -07:00
commit 3151966439
3 changed files with 62 additions and 22 deletions

View File

@ -62,8 +62,8 @@ class PMA_ServerStatusData
$server_status = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL STATUS', 0, 1);
if (PMA_DRIZZLE) {
// Drizzle doesn't put query statistics into variables, add it
$sql = "SELECT concat('Com_', variable_name), variable_value
FROM data_dictionary.GLOBAL_STATEMENTS";
$sql = "SELECT concat('Com_', variable_name), variable_value "
. "FROM data_dictionary.GLOBAL_STATEMENTS";
$statements = $GLOBALS['dbi']->fetchResult($sql, 0, 1);
$server_status = array_merge($server_status, $statements);
}

View File

@ -95,14 +95,36 @@ class PMA_ServerStatusMonitor_Test extends PHPUnit_Framework_TestCase
"big_tables" => "OFF",
);
$dbi->expects($this->at(0))->method('fetchResult')
->with('SHOW GLOBAL STATUS', 0, 1)
->will($this->returnValue($server_status));
$fetchResult = array(
array(
"SHOW GLOBAL STATUS",
0,
1,
null,
0,
$server_status
),
array(
"SHOW GLOBAL VARIABLES",
0,
1,
null,
0,
$server_variables
),
array(
"SELECT concat('Com_', variable_name), variable_value "
. "FROM data_dictionary.GLOBAL_STATEMENTS",
0,
1,
null,
0,
$server_status
),
);
$server_variables = array();
$dbi->expects($this->at(1))->method('fetchResult')
->with('SHOW GLOBAL VARIABLES', 0, 1)
->will($this->returnValue($server_variables));
$dbi->expects($this->any())->method('fetchResult')
->will($this->returnValueMap($fetchResult));
$GLOBALS['dbi'] = $dbi;
@ -157,13 +179,9 @@ class PMA_ServerStatusMonitor_Test extends PHPUnit_Framework_TestCase
$this->assertContains(
__('Monitor Instructions'),
$html
);
);
$this->assertContains(
'Instructions/Setup',
$html
);
$this->assertContains(
'Settings</a><a href="#monitorInstructionsDialog">',
'monitorInstructionsDialog',
$html
);
//validate 4: PMA_getHtmlForAddChartDialog

View File

@ -94,14 +94,36 @@ class PMA_ServerStatusVariables_Test extends PHPUnit_Framework_TestCase
"big_tables" => "OFF",
);
$dbi->expects($this->at(0))->method('fetchResult')
->with('SHOW GLOBAL STATUS', 0, 1)
->will($this->returnValue($server_status));
$fetchResult = array(
array(
"SHOW GLOBAL STATUS",
0,
1,
null,
0,
$server_status
),
array(
"SHOW GLOBAL VARIABLES",
0,
1,
null,
0,
$server_variables
),
array(
"SELECT concat('Com_', variable_name), variable_value "
. "FROM data_dictionary.GLOBAL_STATEMENTS",
0,
1,
null,
0,
$server_status
),
);
$server_variables = array();
$dbi->expects($this->at(1))->method('fetchResult')
->with('SHOW GLOBAL VARIABLES', 0, 1)
->will($this->returnValue($server_variables));
$dbi->expects($this->any())->method('fetchResult')
->will($this->returnValueMap($fetchResult));
$GLOBALS['dbi'] = $dbi;
$this->ServerStatusData = new PMA_ServerStatusData();