From f7d5da319e6f6cfc4929549c05fe7a6e0bcf0c9b Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Thu, 9 Jan 2014 18:22:11 +0100 Subject: [PATCH] Fix coding style. Signed-off-by: Hugues Peccatte --- pmd_general.php | 4 +-- test/AllSeleniumTests.php | 12 ++++----- test/Environment_test.php | 2 +- test/classes/PMA_Theme_test.php | 2 +- test/libraries/PMA_ConfigGenerator_test.php | 4 +-- test/libraries/PMA_Tracker_test.php | 26 +++++++++---------- test/libraries/PMA_mime_test.php | 2 +- test/libraries/PMA_server_privileges_test.php | 22 ++++++++-------- test/libraries/PMA_zip_extension_test.php | 2 +- .../common/PMA_browseUploadFile_test.php | 21 +++++++++++---- ...PMA_getFormattedMaximumUploadSize_test.php | 15 ++++++++--- .../core/PMA_headerLocation_test.php | 11 +++++--- .../core/PMA_warnMissingExtension_test.php | 2 +- .../PmaSeleniumCreateRemoveUserTest.php | 4 +-- test/selenium/PmaSeleniumDbEventsTest.php | 2 +- test/selenium/PmaSeleniumDbOperationsTest.php | 6 ++--- test/selenium/PmaSeleniumExportTest.php | 2 +- test/selenium/PmaSeleniumImportTest.php | 4 +-- test/selenium/PmaSeleniumTrackingTest.php | 2 +- test/theme.php | 8 +++--- 20 files changed, 88 insertions(+), 65 deletions(-) diff --git a/pmd_general.php b/pmd_general.php index 2dd9ecb8e8..b041bbbbee 100644 --- a/pmd_general.php +++ b/pmd_general.php @@ -330,8 +330,8 @@ for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) { onmouseover="old_class = this.className; this.className = 'tab_field_2';" onmouseout="this.className = old_class;" onmousedown="Click_field('markTestSkipped("Error: ".$e->getMessage()); + $this->markTestSkipped("Error: " . $e->getMessage()); } // Check id MySQL server is 5 version diff --git a/test/classes/PMA_Theme_test.php b/test/classes/PMA_Theme_test.php index 8a92bc57b2..5e11d2ee6e 100644 --- a/test/classes/PMA_Theme_test.php +++ b/test/classes/PMA_Theme_test.php @@ -99,7 +99,7 @@ class PMA_ThemeTest extends PHPUnit_Framework_TestCase public function testLoadInfo() { $this->object->setPath('./themes/original'); - $infofile = $this->object->getPath().'/info.inc.php'; + $infofile = $this->object->getPath() . '/info.inc.php'; $this->assertTrue($this->object->loadInfo()); $this->assertEquals( diff --git a/test/libraries/PMA_ConfigGenerator_test.php b/test/libraries/PMA_ConfigGenerator_test.php index c536d9cd38..c525b30c42 100644 --- a/test/libraries/PMA_ConfigGenerator_test.php +++ b/test/libraries/PMA_ConfigGenerator_test.php @@ -49,7 +49,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase " * Generated configuration file\n" . " * Generated by: phpMyAdmin " . $GLOBALS['PMA_Config']->get('PMA_VERSION') . " setup script\n" . - " * Date: " . date(DATE_RFC1123) ."\n" . + " * Date: " . date(DATE_RFC1123) . "\n" . " */\n\n", $result ); @@ -84,7 +84,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase $method->setAccessible(true); $this->assertEquals( - '$cfg[\'var_name\'] = 1;' ."\n", + '$cfg[\'var_name\'] = 1;' . "\n", $method->invoke(null, 'var_name', 1, "\n") ); diff --git a/test/libraries/PMA_Tracker_test.php b/test/libraries/PMA_Tracker_test.php index 0b6d3d415d..1d0ca474d6 100644 --- a/test/libraries/PMA_Tracker_test.php +++ b/test/libraries/PMA_Tracker_test.php @@ -370,9 +370,9 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase 'pma_test', 'pma_tbl', '1', - '". $date ."', - '". $date ."', - 'a:2:{s:7:\"COLUMNS\";a:2:{". + '" . $date . "', + '" . $date . "', + 'a:2:{s:7:\"COLUMNS\";a:2:{" . "i:0;a:3:{s:5:\"Field\";s:6:\"field1\";s:4:\"Type\";s:7:\"int(11)\";" . "s:3:\"Key\";s:3:\"PRI\";}" . "i:1;a:3:{s:5:\"Field\";s:6:\"field2\";s:4:\"Type\";s:4:\"text\";" . @@ -380,9 +380,9 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase "s:7:\"INDEXES\";a:1:{" . "i:0;a:3:{s:5:\"Table\";s:7:\"pma_tbl\";s:5:\"Field\";s:6:\"field1\";" . "s:3:\"Key\";s:7:\"PRIMARY\";}}}', - '# log ". $date ." pma_test_user" . + '# log " . $date . " pma_test_user" . "\nDROP VIEW IF EXISTS `pma_tbl`;" . - "\n# log ". $date ." pma_test_user" . + "\n# log " . $date . " pma_test_user" . "\n\n;" . "\n', '" . @@ -486,10 +486,10 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase 'pma_test', '', '1', - '". $date ."', - '". $date ."', + '" . $date . "', + '" . $date . "', '', - '# log ". $date ." pma_test_user" . + '# log " . $date . " pma_test_user" . "\nSHOW DATABASES', '" . "\n', @@ -538,10 +538,10 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase ->getMock(); $sql_query = " UPDATE pma_table_tracking SET `tracking_active` = " . - "'" . $new_state ."' " . - " WHERE `db_name` = '". $dbname ."' " . - " AND `table_name` = '". $tablename ."' " . - " AND `version` = '". $version ."' "; + "'" . $new_state . "' " . + " WHERE `db_name` = '" . $dbname . "' " . + " AND `table_name` = '" . $tablename . "' " . + " AND `version` = '" . $version . "' "; $GLOBALS['controllink'] = null; @@ -775,7 +775,7 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase $sql_query = " SELECT * FROM `pma_db`.`tracking`" . " WHERE `db_name` = 'pma''db' " . " AND `table_name` = 'pma''table' " . - " AND `version` = '1.0' ". + " AND `version` = '1.0' " . " ORDER BY `version` DESC LIMIT 1"; $GLOBALS['controllink'] = null; diff --git a/test/libraries/PMA_mime_test.php b/test/libraries/PMA_mime_test.php index b58d8c026f..b49bac52be 100644 --- a/test/libraries/PMA_mime_test.php +++ b/test/libraries/PMA_mime_test.php @@ -58,7 +58,7 @@ class PMA_MIME_Test extends PHPUnit_Framework_TestCase 'image/png' ), array( - chr(0xff).chr(0xd8), + chr(0xff) . chr(0xd8), 'image/jpeg' ), ); diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index f9fd822a8f..fd272d1d8e 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -490,8 +490,8 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $db, $table, $username, $hostname ); $sql = "SELECT * FROM `mysql`.`user`" - ." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" - ." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';"; + . " WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + . " AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';"; $this->assertEquals( $sql, $ret @@ -504,10 +504,10 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $db, $table, $username, $hostname ); $sql = "SELECT * FROM `mysql`.`db`" - ." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" - ." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'" - ." AND '" . PMA_Util::unescapeMysqlWildcards($db) . "'" - ." LIKE `Db`;"; + . " WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + . " AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'" + . " AND '" . PMA_Util::unescapeMysqlWildcards($db) . "'" + . " LIKE `Db`;"; $this->assertEquals( $sql, $ret @@ -520,11 +520,11 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase $db, $table, $username, $hostname ); $sql = "SELECT `Table_priv`" - ." FROM `mysql`.`tables_priv`" - ." WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" - ." AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'" - ." AND `Db` = '" . PMA_Util::unescapeMysqlWildcards($db) . "'" - ." AND `Table_name` = '" . PMA_Util::sqlAddSlashes($table) . "';"; + . " FROM `mysql`.`tables_priv`" + . " WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" + . " AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "'" + . " AND `Db` = '" . PMA_Util::unescapeMysqlWildcards($db) . "'" + . " AND `Table_name` = '" . PMA_Util::sqlAddSlashes($table) . "';"; $this->assertEquals( $sql, $ret diff --git a/test/libraries/PMA_zip_extension_test.php b/test/libraries/PMA_zip_extension_test.php index 705d7f6a46..16de772b94 100644 --- a/test/libraries/PMA_zip_extension_test.php +++ b/test/libraries/PMA_zip_extension_test.php @@ -50,7 +50,7 @@ class PMA_ZipExtension_Test extends PHPUnit_Framework_TestCase null, array( 'error' => '', - 'data' => 'TEST FILE'. "\n" + 'data' => 'TEST FILE' . "\n" ) ), array( diff --git a/test/libraries/common/PMA_browseUploadFile_test.php b/test/libraries/common/PMA_browseUploadFile_test.php index 6fe9c89b14..cbe9a9f747 100644 --- a/test/libraries/common/PMA_browseUploadFile_test.php +++ b/test/libraries/common/PMA_browseUploadFile_test.php @@ -21,8 +21,10 @@ class PMA_GetBrowseUploadFileBlock_Test extends PHPUnit_Framework_TestCase $GLOBALS['is_upload'] = false; } - /* + /** * Data provider for test + * + * @return array */ public function dataProvider() { @@ -38,19 +40,28 @@ class PMA_GetBrowseUploadFileBlock_Test extends PHPUnit_Framework_TestCase } /** - * @dataProvider dataProvider + * Test for PMA_Util::getBrowseUploadFileBlock + * + * @param int $size Size + * @param string $unit Unit + * @param string $res Result + * * @return void + * + * @dataProvider dataProvider */ function testBrowseUploadFile($size, $unit, $res) { $this->assertEquals( PMA_Util::getBrowseUploadFileBlock($size), - '' + '' . '' . '' . '' - . "(" . __('Max: '). $res . $unit .")" . "\n" - . '' . "\n" + . "(" . __('Max: ') . $res . $unit . ")" . "\n" + . '' . "\n" ); } } diff --git a/test/libraries/common/PMA_getFormattedMaximumUploadSize_test.php b/test/libraries/common/PMA_getFormattedMaximumUploadSize_test.php index 8b5f52513d..c99717e6ce 100644 --- a/test/libraries/common/PMA_getFormattedMaximumUploadSize_test.php +++ b/test/libraries/common/PMA_getFormattedMaximumUploadSize_test.php @@ -16,8 +16,10 @@ require_once 'libraries/php-gettext/gettext.inc'; class PMA_GetFormattedMaximumUploadSize_Test extends PHPUnit_Framework_TestCase { - /* + /** * Data provider for test + * + * @return array */ public function dataProvider() { @@ -33,13 +35,20 @@ class PMA_GetFormattedMaximumUploadSize_Test extends PHPUnit_Framework_TestCase } /** - * @dataProvider dataProvider + * Test for PMA_Util::getFormattedMaximumUploadSize + * + * @param int $size Size + * @param string $unit Unit + * @param string $res Result + * * @return void + * + * @dataProvider dataProvider */ function testMaximumUploadSize($size, $unit, $res) { $this->assertEquals( - "(" . __('Max: '). $res . $unit .")", + "(" . __('Max: ') . $res . $unit . ")", PMA_Util::getFormattedMaximumUploadSize($size) ); diff --git a/test/libraries/core/PMA_headerLocation_test.php b/test/libraries/core/PMA_headerLocation_test.php index d4e1ffe7c3..f147d15d44 100644 --- a/test/libraries/core/PMA_headerLocation_test.php +++ b/test/libraries/core/PMA_headerLocation_test.php @@ -213,17 +213,20 @@ class PMA_HeaderLocation_Test extends PHPUnit_Framework_TestCase "\n" . "\n" . "\n" . - "\n" . - "\n" . "\n" . "\n" . "\n"; diff --git a/test/libraries/core/PMA_warnMissingExtension_test.php b/test/libraries/core/PMA_warnMissingExtension_test.php index b8bcc42d0d..02a6cd5edb 100644 --- a/test/libraries/core/PMA_warnMissingExtension_test.php +++ b/test/libraries/core/PMA_warnMissingExtension_test.php @@ -61,7 +61,7 @@ class PMA_WarnMissingExtension_Test extends PHPUnit_Framework_TestCase $warn = 'The ' . $ext . ' extension is missing. Please check your PHP configuration.' - . ' ' .$extra; + . ' ' . $extra; ob_start(); PMA_warnMissingExtension($ext, true, $extra); diff --git a/test/selenium/PmaSeleniumCreateRemoveUserTest.php b/test/selenium/PmaSeleniumCreateRemoveUserTest.php index 6182960d66..b6a160a342 100644 --- a/test/selenium/PmaSeleniumCreateRemoveUserTest.php +++ b/test/selenium/PmaSeleniumCreateRemoveUserTest.php @@ -88,10 +88,10 @@ class PmaSeleniumCreateRemoveUserTest extends PHPUnit_Extensions_Selenium2TestCa $this->assertContains('You have added a new user', $success->text()); $el = $this->_helper->waitForElement("byId", "usersForm"); - $temp = $this->_txtUsername."&#27;localhost"; + $temp = $this->_txtUsername . "&#27;localhost"; $this->byXPath( - "(//input[@name='selected_usr[]'])[@value='".$temp."']" + "(//input[@name='selected_usr[]'])[@value='" . $temp . "']" )->click(); $this->byId("checkbox_drop_users_db")->click(); diff --git a/test/selenium/PmaSeleniumDbEventsTest.php b/test/selenium/PmaSeleniumDbEventsTest.php index 2eec5f23d4..316caebfe3 100644 --- a/test/selenium/PmaSeleniumDbEventsTest.php +++ b/test/selenium/PmaSeleniumDbEventsTest.php @@ -81,7 +81,7 @@ class PmaSeleniumDbEventsTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->dbQuery( "CREATE EVENT `test_event` ON SCHEDULE EVERY 2 MINUTE_SECOND STARTS " . "'$start' ENDS '$end' ON COMPLETION NOT PRESERVE ENABLE " - . "DO UPDATE `". $this->_dbname. "`.`test_table` SET val = val + 1" + . "DO UPDATE `" . $this->_dbname . "`.`test_table` SET val = val + 1" ); } diff --git a/test/selenium/PmaSeleniumDbOperationsTest.php b/test/selenium/PmaSeleniumDbOperationsTest.php index 898e9782ba..47f57c4257 100644 --- a/test/selenium/PmaSeleniumDbOperationsTest.php +++ b/test/selenium/PmaSeleniumDbOperationsTest.php @@ -106,7 +106,7 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertEquals(1, $result->num_rows); $result = $this->_helper->dbQuery( - "SHOW DATABASES LIKE '". $this->_dbname ."';" + "SHOW DATABASES LIKE '" . $this->_dbname . "';" ); $this->assertEquals(0, $result->num_rows); @@ -127,8 +127,8 @@ class PmaSeleniumDbOperationsTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement( "byXPath", - "//div[@class='success' and contains(., 'Database " . $this->_dbname ." " - . "has been copied to pma_test_db_copy')]" + "//div[@class='success' and contains(., 'Database " . $this->_dbname + . " has been copied to pma_test_db_copy')]" ); $result = $this->_helper->dbQuery( diff --git a/test/selenium/PmaSeleniumExportTest.php b/test/selenium/PmaSeleniumExportTest.php index c1e47c27dc..3ad9341e20 100644 --- a/test/selenium/PmaSeleniumExportTest.php +++ b/test/selenium/PmaSeleniumExportTest.php @@ -99,7 +99,7 @@ class PmaSeleniumExportTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement("byLinkText", $this->_dbname)->click(); $this->_helper->waitForElement( "byXPath", - "//a[@class='item' and contains(., 'Database: ". $this->_dbname ."')]" + "//a[@class='item' and contains(., 'Database: " . $this->_dbname . "')]" ); $text = $this->_doExport('db', $plugin); diff --git a/test/selenium/PmaSeleniumImportTest.php b/test/selenium/PmaSeleniumImportTest.php index 5aae306e8f..569f4b2f65 100644 --- a/test/selenium/PmaSeleniumImportTest.php +++ b/test/selenium/PmaSeleniumImportTest.php @@ -82,7 +82,7 @@ class PmaSeleniumImportTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement("byLinkText", $this->_dbname)->click(); $this->_helper->waitForElement( "byXPath", - "//a[@class='item' and contains(., 'Database: ". $this->_dbname ."')]" + "//a[@class='item' and contains(., 'Database: " . $this->_dbname . "')]" ); $this->_doImport("db"); @@ -111,7 +111,7 @@ class PmaSeleniumImportTest extends PHPUnit_Extensions_Selenium2TestCase $this->_helper->waitForElement("byLinkText", $this->_dbname)->click(); $this->_helper->waitForElement( "byXPath", - "//a[@class='item' and contains(., 'Database: ". $this->_dbname ."')]" + "//a[@class='item' and contains(., 'Database: " . $this->_dbname . "')]" ); // got to table page diff --git a/test/selenium/PmaSeleniumTrackingTest.php b/test/selenium/PmaSeleniumTrackingTest.php index ccd2920b0c..ae0676ee61 100644 --- a/test/selenium/PmaSeleniumTrackingTest.php +++ b/test/selenium/PmaSeleniumTrackingTest.php @@ -74,7 +74,7 @@ class PmaSeleniumTrackingTest extends PHPUnit_Extensions_Selenium2TestCase $this->byLinkText($this->_dbname)->click(); $this->_helper->waitForElement( "byXPath", - "//a[@class='item' and contains(., 'Database: ". $this->_dbname ."')]" + "//a[@class='item' and contains(., 'Database: " . $this->_dbname . "')]" ); $ele = $this->byLinkText("More"); $this->moveto($ele); diff --git a/test/theme.php b/test/theme.php index f2e0391315..49a55eedee 100644 --- a/test/theme.php +++ b/test/theme.php @@ -45,9 +45,9 @@ header('Content-Type: text/html; charset=utf-8'); $separator = ' ยป' . "\n"; $item = '' - .' ' . "\n" - .'%4$s: %3$s' . "\n"; + . ' ' . "\n" + . '%4$s: %3$s' . "\n"; echo '
' . "\n"; printf( @@ -84,7 +84,7 @@ printf( ); echo '' - .'"Table comment"' . "\n"; + . '"Table comment"' . "\n"; echo '
';