From d6be232ba30438afaa7c99774f412fab969250cd Mon Sep 17 00:00:00 2001 From: xmujay Date: Sat, 6 Jul 2013 23:39:21 +0800 Subject: [PATCH] fix the code style for UT files --- test/libraries/PMA_server_binlog_test.php | 28 +++++++++-------- test/libraries/PMA_server_collations_test.php | 22 +++++++------- test/libraries/PMA_server_common_test.php | 30 ++++++++++--------- test/libraries/PMA_server_engines_test.php | 12 ++++---- test/libraries/PMA_server_plugins_test.php | 2 +- 5 files changed, 50 insertions(+), 44 deletions(-) diff --git a/test/libraries/PMA_server_binlog_test.php b/test/libraries/PMA_server_binlog_test.php index 3660a27fb8..478fef3bbd 100644 --- a/test/libraries/PMA_server_binlog_test.php +++ b/test/libraries/PMA_server_binlog_test.php @@ -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&'; $this->assertContains( - 'server_binlog.php?log=log&dontlimitchars=1&pos=3&server=1&', + $urlNavigation, $html ); $this->assertContains( diff --git a/test/libraries/PMA_server_collations_test.php b/test/libraries/PMA_server_collations_test.php index d9b03377b6..aad4eccb39 100644 --- a/test/libraries/PMA_server_collations_test.php +++ b/test/libraries/PMA_server_collations_test.php @@ -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 diff --git a/test/libraries/PMA_server_common_test.php b/test/libraries/PMA_server_common_test.php index c12e383120..ce2c20788a 100644 --- a/test/libraries/PMA_server_common_test.php +++ b/test/libraries/PMA_server_common_test.php @@ -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( '', - $html + $html ); $this->assertContains( 'Storage Engines', - $html + $html ); - //server_databases - $html = PMA_getSubPageHeader("databases"); + //server_databases + $html = PMA_getSubPageHeader("databases"); $this->assertContains( '', - $html + $html ); $this->assertContains( 'Databases', - $html + $html ); - //server_replication - $html = PMA_getSubPageHeader("replication"); + //server_replication + $html = PMA_getSubPageHeader("replication"); + $replication_img = ''; $this->assertContains( - '', - $html + $replication_img, + $html ); $this->assertContains( 'Replication', - $html + $html ); } diff --git a/test/libraries/PMA_server_engines_test.php b/test/libraries/PMA_server_engines_test.php index 0b3a8109e3..50702d585f 100644 --- a/test/libraries/PMA_server_engines_test.php +++ b/test/libraries/PMA_server_engines_test.php @@ -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 ); } diff --git a/test/libraries/PMA_server_plugins_test.php b/test/libraries/PMA_server_plugins_test.php index 375edbe4d4..2a35513118 100644 --- a/test/libraries/PMA_server_plugins_test.php +++ b/test/libraries/PMA_server_plugins_test.php @@ -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')