fix the code style for UT files

This commit is contained in:
xmujay 2013-07-06 23:39:21 +08:00
parent a90ae2550f
commit d6be232ba3
5 changed files with 50 additions and 44 deletions

View File

@ -58,7 +58,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getLogSelector()
public function testPMAGetLogSelector()
{
$binary_log_file_names = array();
$binary_log_file_names[] = array("Log_name"=>"index1", "File_size"=>100);
@ -88,7 +88,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getLogInfo()
public function testPMAGetLogInfo()
{
$binary_log_file_names = array();
$binary_log_file_names[] = array("Log_name"=>"index1", "File_size"=>100);
@ -121,27 +121,27 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
)
);
$value = array(
'Info' => "index1_Info",
'Log_name' => "index1_Log_name",
'Pos' => "index1_Pos",
'Event_type' => "index1_Event_type",
'End_log_pos' => "index1_End_log_pos",
'Server_id' => "index1_Server_id",
'Info' => "index1_Info",
'Log_name' => "index1_Log_name",
'Pos' => "index1_Pos",
'Event_type' => "index1_Event_type",
'End_log_pos' => "index1_End_log_pos",
'Server_id' => "index1_Server_id",
);
$count = 3;
//expects functions
$dbi->expects($this->once())->method('query')
->will($this->returnValue($result));
->will($this->returnValue($result));
$dbi->expects($this->once())->method('numRows')
->will($this->returnValue($count));
->will($this->returnValue($count));
$dbi->expects($this->at(0))->method('fetchAssoc')
->will($this->returnValue($value));
->will($this->returnValue($value));
$dbi->expects($this->at(1))->method('fetchAssoc')
->will($this->returnValue(false));
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
@ -164,8 +164,10 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
$html
);
//validate 4: PMA_getNavigationRow is right
$urlNavigation = 'server_binlog.php?log=log&dontlimitchars=1&'
. 'pos=3&server=1&amp';
$this->assertContains(
'server_binlog.php?log=log&dontlimitchars=1&pos=3&server=1&amp',
$urlNavigation,
$html
);
$this->assertContains(

View File

@ -17,8 +17,8 @@ $GLOBALS['url_query'] = "url_query";
$GLOBALS['PMA_PHP_SELF'] = PMA_getenv('PHP_SELF');
$GLOBALS['lang'] = "en";
$GLOBALS['available_languages']= array(
"en" => array("English", "US-ENGLISH"),
"ch" => array("Chinese", "TW-Chinese")
"en" => array("English", "US-ENGLISH"),
"ch" => array("Chinese", "TW-Chinese")
);
$GLOBALS['text_dir'] = "text_dir";
$GLOBALS['cfg']['DBG']['sql'] = false;
@ -73,32 +73,32 @@ class PMA_ServerCollations_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getHtmlForCharsets()
public function testPMAGetHtmlForCharsets()
{
$mysql_charsets = array("armscii8", "ascii", "big5", "binary");
$mysql_collations = array(
"armscii8" => array("armscii8"),
"armscii8" => array("armscii8"),
"ascii" => array("ascii"),
"big5" => array("big5"),
"binary" => array("binary"),
"binary" => array("binary"),
);
$mysql_charsets_descriptions = array(
"armscii8" => "PMA_armscii8_general_ci",
"armscii8" => "PMA_armscii8_general_ci",
"ascii" => "PMA_ascii_general_ci",
"big5" => "PMA_big5_general_ci",
"binary" => "PMA_binary_general_ci",
"binary" => "PMA_binary_general_ci",
);
$mysql_default_collations = array(
"armscii8" => "armscii8",
"armscii8" => "armscii8",
"ascii" => "ascii",
"big5" => "big5",
"binary" => "binary",
"binary" => "binary",
);
$mysql_collations_available = array(
"armscii8" => true,
"armscii8" => true,
"ascii" => true,
"big5" => true,
"binary" => true,
"binary" => true,
);
//Mock DBI

View File

@ -32,39 +32,41 @@ class PMA_ServerCommon_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getSubPageHeader()
public function testPMAGetSubPageHeader()
{
//server_engines
$html = PMA_getSubPageHeader("engines");
//server_engines
$html = PMA_getSubPageHeader("engines");
$this->assertContains(
'<img src="themes/dot.gif" title="" alt="" class="icon ic_b_engine" />',
$html
$html
);
$this->assertContains(
'Storage Engines',
$html
$html
);
//server_databases
$html = PMA_getSubPageHeader("databases");
//server_databases
$html = PMA_getSubPageHeader("databases");
$this->assertContains(
'<img src="themes/dot.gif" title="" alt="" class="icon ic_s_db" />',
$html
$html
);
$this->assertContains(
'Databases',
$html
$html
);
//server_replication
$html = PMA_getSubPageHeader("replication");
//server_replication
$html = PMA_getSubPageHeader("replication");
$replication_img = '<img src="themes/dot.gif" title="" '
. 'alt="" class="icon ic_s_replication" />';
$this->assertContains(
'<img src="themes/dot.gif" title="" alt="" class="icon ic_s_replication" />',
$html
$replication_img,
$html
);
$this->assertContains(
'Replication',
$html
$html
);
}

View File

@ -61,7 +61,7 @@ class PMA_ServerEngines_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getPluginAndModuleInfo()
public function testPMAGetPluginAndModuleInfo()
{
//test PMA_getHtmlForAllServerEngines
$html = PMA_getHtmlForServerEngines();
@ -110,16 +110,16 @@ class PMA_ServerEngines_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getPluginAndModuleInfo_Specific()
public function testPMAGetPluginAndModuleInfoSpecific()
{
$_REQUEST['engine'] = "FEDERATED";
$_REQUEST['engine'] = "FEDERATED";
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
//test PMA_getHtmlForAllServerEngines for specific engines "FEDERATED"
$html = PMA_getHtmlForServerEngines();
@ -136,8 +136,10 @@ class PMA_ServerEngines_Test extends PHPUnit_Framework_TestCase
'This MySQL server does not support the FEDERATED storage engine.',
$html
);
$enginer_info = 'There is no detailed status information '
. 'available for this storage engine';
$this->assertContains(
'There is no detailed status information available for this storage engine',
$enginer_info,
$html
);
}

View File

@ -58,7 +58,7 @@ class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
*
* @return void
*/
public function testPMA_getPluginAndModuleInfo()
public function testPMAGetPluginAndModuleInfo()
{
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')