diff options
283 files changed, 9073 insertions, 3426 deletions
diff --git a/browse_foreigners.php b/browse_foreigners.php index 10d0fad64b..4495606f93 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -23,7 +23,7 @@ require_once ROOT_PATH . 'libraries/common.inc.php'; */ $request_params = [ 'data', - 'field' + 'field', ]; foreach ($request_params as $one_request_param) { diff --git a/db_operations.php b/db_operations.php index f88285d6d0..76a6368e02 100644 --- a/db_operations.php +++ b/db_operations.php @@ -103,7 +103,7 @@ if (strlen($GLOBALS['db']) > 0 'libraries/classes/Plugins/Export/', [ 'single_table' => isset($single_table), - 'export_type' => 'database' + 'export_type' => 'database', ] ); diff --git a/examples/signon-script.php b/examples/signon-script.php index f32a582413..202dca8c05 100644 --- a/examples/signon-script.php +++ b/examples/signon-script.php @@ -25,11 +25,17 @@ function get_login_credentials($user) { /* Optionally we can use passed username */ if (! empty($user)) { - return [$user, 'password']; + return [ + $user, + 'password', + ]; } /* Here we would retrieve the credentials */ - $credentials = ['root', '']; + $credentials = [ + 'root', + '', + ]; return $credentials; } diff --git a/export.php b/export.php index fbae9adcb2..7d6f623368 100644 --- a/export.php +++ b/export.php @@ -172,7 +172,7 @@ $post_params = [ 'latex_data_continued_caption', 'latex_data_label', 'latex_null', - 'aliases' + 'aliases', ]; foreach ($post_params as $one_post_param) { @@ -196,7 +196,7 @@ $export_plugin = Plugins::getPlugin( 'libraries/classes/Plugins/Export/', [ 'export_type' => $export_type, - 'single_table' => isset($single_table) + 'single_table' => isset($single_table), ] ); @@ -210,7 +210,7 @@ if (empty($export_plugin)) { */ $compression_methods = [ 'zip', - 'gzip' + 'gzip', ]; /** @@ -291,7 +291,8 @@ if ($export_type == 'server') { } elseif ($export_type == 'table' && strlen($db) > 0 && strlen($table) > 0) { $err_url = 'tbl_export.php' . Url::getCommon( [ - 'db' => $db, 'table' => $table + 'db' => $db, + 'table' => $table, ] ); } else { diff --git a/gis_data_editor.php b/gis_data_editor.php index 12183826b1..f7ca095c59 100644 --- a/gis_data_editor.php +++ b/gis_data_editor.php @@ -39,7 +39,7 @@ $gis_types = [ 'MULTILINESTRING', 'POLYGON', 'MULTIPOLYGON', - 'GEOMETRYCOLLECTION' + 'GEOMETRYCOLLECTION', ]; // Extract type from the initial call and make sure that it's a valid one. @@ -83,9 +83,14 @@ $result = "'" . $wkt . "'," . $srid; $visualizationSettings = [ 'width' => 450, 'height' => 300, - 'spatialColumn' => 'wkt' + 'spatialColumn' => 'wkt', +]; +$data = [ + [ + 'wkt' => $wkt_with_zero, + 'srid' => $srid, + ], ]; -$data = [['wkt' => $wkt_with_zero, 'srid' => $srid]]; $visualization = GisVisualization::getByData($data, $visualizationSettings) ->toImage('svg'); diff --git a/import.php b/import.php index a4828b1401..99363f6da3 100644 --- a/import.php +++ b/import.php @@ -105,7 +105,7 @@ $post_params = [ 'message_to_show', 'noplugin', 'skip_queries', - 'local_import_file' + 'local_import_file', ]; foreach ($post_params as $one_post_param) { @@ -246,7 +246,7 @@ if (! in_array( 'ods', 'shp', 'sql', - 'xml' + 'xml', ] ) ) { @@ -257,7 +257,7 @@ if (! in_array( $post_patterns = [ '/^force_file_/', - '/^' . $format . '_/' + '/^' . $format . '_/', ]; Core::setPostAsGlobal($post_patterns); @@ -269,7 +269,10 @@ PhpMyAdmin\Util::checkParameters(['import_type', 'format']); $format = Core::securePath($format); if (strlen($table) > 0 && strlen($db) > 0) { - $urlparams = ['db' => $db, 'table' => $table]; + $urlparams = [ + 'db' => $db, + 'table' => $table, + ]; } elseif (strlen($db) > 0) { $urlparams = ['db' => $db]; } else { @@ -538,7 +541,10 @@ if (! $error && isset($_POST['skip'])) { // This array contain the data like numberof valid sql queries in the statement // and complete valid sql statement (which affected for rows) -$sql_data = ['valid_sql' => [], 'valid_queries' => 0]; +$sql_data = [ + 'valid_sql' => [], + 'valid_queries' => 0, +]; if (! $error) { /** @@ -40,7 +40,7 @@ $drops = [ 'server', 'collation_connection', 'db', - 'table' + 'table', ]; foreach ($drops as $each_drop) { if (array_key_exists($each_drop, $_GET)) { @@ -55,7 +55,8 @@ unset($drops, $each_drop); * */ $target_blacklist = [ - 'import.php', 'export.php' + 'import.php', + 'export.php', ]; // If we have a valid target, let's load that script instead diff --git a/js/messages.php b/js/messages.php index f1f8b7e6bf..76ff2b0128 100644 --- a/js/messages.php +++ b/js/messages.php @@ -810,7 +810,7 @@ Sanitize::printJsValue( __('September'), __('October'), __('November'), - __('December') + __('December'), ] ); Sanitize::printJsValue( @@ -839,7 +839,7 @@ Sanitize::printJsValue( /* l10n: Short month name */ __('Nov'), /* l10n: Short month name */ - __('Dec') + __('Dec'), ] ); Sanitize::printJsValue( @@ -851,7 +851,7 @@ Sanitize::printJsValue( __('Wednesday'), __('Thursday'), __('Friday'), - __('Saturday') + __('Saturday'), ] ); Sanitize::printJsValue( @@ -870,7 +870,7 @@ Sanitize::printJsValue( /* l10n: Short week day name */ __('Fri'), /* l10n: Short week day name */ - __('Sat') + __('Sat'), ] ); Sanitize::printJsValue( @@ -889,7 +889,7 @@ Sanitize::printJsValue( /* l10n: Minimal week day name */ __('Fr'), /* l10n: Minimal week day name */ - __('Sa') + __('Sa'), ] ); /* l10n: Column header for week of the year in calendar */ diff --git a/libraries/classes/Advisor.php b/libraries/classes/Advisor.php index 15f07ca8bd..139d1e8c67 100644 --- a/libraries/classes/Advisor.php +++ b/libraries/classes/Advisor.php @@ -237,7 +237,7 @@ class Advisor return [ 'parse' => ['errors' => $this->parseResult['errors']], - 'run' => $this->runResult + 'run' => $this->runResult, ]; } @@ -375,7 +375,10 @@ class Advisor { $jst = preg_split('/\s*\|\s*/', $rule['justification'], 2); if (count($jst) > 1) { - return [$jst[0], $jst[1]]; + return [ + $jst[0], + $jst[1], + ]; } return [$rule['justification']]; } @@ -421,14 +424,20 @@ class Advisor // linking to server_variables.php $rule['recommendation'] = preg_replace_callback( '/\{([a-z_0-9]+)\}/Ui', - [$this, 'replaceVariable'], + [ + $this, + 'replaceVariable', + ], $this->translate($rule['recommendation']) ); // Replaces external Links with Core::linkURL() generated links $rule['recommendation'] = preg_replace_callback( '#href=("|\')(https?://[^\1]+)\1#i', - [$this, 'replaceLinkURL'], + [ + $this, + 'replaceLinkURL', + ], $rule['recommendation'] ); break; @@ -504,11 +513,20 @@ class Advisor __('Error in reading file: The file \'%s\' does not exist or is not readable!'), $filename ); - return ['rules' => $rules, 'lines' => $lines, 'errors' => $errors]; + return [ + 'rules' => $rules, + 'lines' => $lines, + 'errors' => $errors, + ]; } $ruleSyntax = [ - 'name', 'formula', 'test', 'issue', 'recommendation', 'justification' + 'name', + 'formula', + 'test', + 'issue', + 'recommendation', + 'justification', ]; $numRules = count($ruleSyntax); $numLines = count($file); @@ -589,7 +607,11 @@ class Advisor } } - return ['rules' => $rules, 'lines' => $lines, 'errors' => $errors]; + return [ + 'rules' => $rules, + 'lines' => $lines, + 'errors' => $errors, + ]; } /** diff --git a/libraries/classes/BrowseForeigners.php b/libraries/classes/BrowseForeigners.php index dad21d2d19..6b1d5dbdb8 100644 --- a/libraries/classes/BrowseForeigners.php +++ b/libraries/classes/BrowseForeigners.php @@ -146,7 +146,11 @@ class BrowseForeigners $output .= '</tr>'; - return [$output, $horizontal_count, $indexByDescription]; + return [ + $output, + $horizontal_count, + $indexByDescription, + ]; } /** @@ -295,7 +299,10 @@ class BrowseForeigners . '...' ); } - return [$description, $descriptionTitle]; + return [ + $description, + $descriptionTitle, + ]; } /** diff --git a/libraries/classes/CentralColumns.php b/libraries/classes/CentralColumns.php index 7643d47303..ef9d2a8251 100644 --- a/libraries/classes/CentralColumns.php +++ b/libraries/classes/CentralColumns.php @@ -265,7 +265,7 @@ class CentralColumns $attribute = ""; if (isset($def['Type'])) { $extracted_columnspec = Util::extractColumnSpec($def['Type']); - $attribute = trim($extracted_columnspec[ 'attribute']); + $attribute = trim($extracted_columnspec['attribute']); $type = $extracted_columnspec['type']; $length = $extracted_columnspec['spec_in_brackets']; } @@ -760,10 +760,10 @@ class CentralColumns 'ci' => 0, 'ci_offset' => 0, 'column_meta' => [ - 'Field' => $row['col_name'] + 'Field' => $row['col_name'], ], 'cfg_relation' => [ - 'centralcolumnswork' => false + 'centralcolumnswork' => false, ], 'max_rows' => $this->maxRows, ]) @@ -1004,8 +1004,14 @@ class CentralColumns { $html = '<form id="multi_edit_central_columns">'; $header_cells = [ - __('Name'), __('Type'), __('Length/Values'), __('Default'), - __('Collation'), __('Attributes'), __('Null'), __('A_I') + __('Name'), + __('Type'), + __('Length/Values'), + __('Default'), + __('Collation'), + __('Attributes'), + __('Null'), + __('A_I'), ]; $html .= $this->getEditTableHeader($header_cells); $selected_fld_safe = []; diff --git a/libraries/classes/CheckUserPrivileges.php b/libraries/classes/CheckUserPrivileges.php index 36f564309d..1c0d6fd529 100644 --- a/libraries/classes/CheckUserPrivileges.php +++ b/libraries/classes/CheckUserPrivileges.php @@ -82,7 +82,7 @@ class CheckUserPrivileges return [ $show_grants_str, $show_grants_dbname, - $show_grants_tblname + $show_grants_tblname, ]; } diff --git a/libraries/classes/Config.php b/libraries/classes/Config.php index 23fc6fb358..38c1bf7354 100644 --- a/libraries/classes/Config.php +++ b/libraries/classes/Config.php @@ -711,8 +711,16 @@ class Config } if ($commit !== false) { - $author = ['name' => '', 'email' => '', 'date' => '']; - $committer = ['name' => '', 'email' => '', 'date' => '']; + $author = [ + 'name' => '', + 'email' => '', + 'date' => '' + ]; + $committer = [ + 'name' => '', + 'email' => '', + 'date' => '' + ]; do { $dataline = array_shift($commit); @@ -1414,7 +1422,7 @@ class Config 'PMA_IS_GD2', 'PMA_USR_OS', 'PMA_USR_BROWSER_VER', - 'PMA_USR_BROWSER_AGENT' + 'PMA_USR_BROWSER_AGENT', ]; foreach ($defines as $define) { diff --git a/libraries/classes/Config/Descriptions.php b/libraries/classes/Config/Descriptions.php index e441ae8838..da7d106476 100644 --- a/libraries/classes/Config/Descriptions.php +++ b/libraries/classes/Config/Descriptions.php @@ -31,8 +31,14 @@ class Descriptions public static function get($path, $type = 'name') { $key = str_replace( - ['Servers/1/', '/'], - ['Servers/', '_'], + [ + 'Servers/1/', + '/', + ], + [ + 'Servers/', + '_', + ], $path ); $value = self::getString($key, $type); diff --git a/libraries/classes/Config/FormDisplay.php b/libraries/classes/Config/FormDisplay.php index 44bbac1ae5..126a562c31 100644 --- a/libraries/classes/Config/FormDisplay.php +++ b/libraries/classes/Config/FormDisplay.php @@ -860,9 +860,18 @@ class FormDisplay ) { $comment = ''; $funcs = [ - 'ZipDump' => ['zip_open', 'gzcompress'], - 'GZipDump' => ['gzopen', 'gzencode'], - 'BZipDump' => ['bzopen', 'bzcompress'] + 'ZipDump' => [ + 'zip_open', + 'gzcompress', + ], + 'GZipDump' => [ + 'gzopen', + 'gzencode', + ], + 'BZipDump' => [ + 'bzopen', + 'bzcompress', + ], ]; if (! function_exists($funcs[$systemPath][0])) { $comment = sprintf( diff --git a/libraries/classes/Config/FormDisplayTemplate.php b/libraries/classes/Config/FormDisplayTemplate.php index 11c9671d9c..08a4ed2561 100644 --- a/libraries/classes/Config/FormDisplayTemplate.php +++ b/libraries/classes/Config/FormDisplayTemplate.php @@ -193,10 +193,22 @@ class FormDisplayTemplate // The first element contains the filename and the second // element is used for the "alt" and "title" attributes. $iconInit = [ - 'edit' => ['b_edit', ''], - 'help' => ['b_help', __('Documentation')], - 'reload' => ['s_reload', ''], - 'tblops' => ['b_tblops', ''] + 'edit' => [ + 'b_edit', + '', + ], + 'help' => [ + 'b_help', + __('Documentation'), + ], + 'reload' => [ + 's_reload', + '', + ], + 'tblops' => [ + 'b_tblops', + '', + ], ]; if ($isSetupScript) { // When called from the setup script, we don't have access to the diff --git a/libraries/classes/Config/Forms/Page/BrowseForm.php b/libraries/classes/Config/Forms/Page/BrowseForm.php index b4c41da030..eee578aa1a 100644 --- a/libraries/classes/Config/Forms/Page/BrowseForm.php +++ b/libraries/classes/Config/Forms/Page/BrowseForm.php @@ -24,7 +24,7 @@ class BrowseForm extends BaseForm public static function getForms() { return [ - 'Browse' => MainForm::getForms()['Browse'] + 'Browse' => MainForm::getForms()['Browse'], ]; } } diff --git a/libraries/classes/Config/Forms/Page/DbStructureForm.php b/libraries/classes/Config/Forms/Page/DbStructureForm.php index dd82b70726..4f9a8e4979 100644 --- a/libraries/classes/Config/Forms/Page/DbStructureForm.php +++ b/libraries/classes/Config/Forms/Page/DbStructureForm.php @@ -24,7 +24,7 @@ class DbStructureForm extends BaseForm public static function getForms() { return [ - 'DbStructure' => MainForm::getForms()['DbStructure'] + 'DbStructure' => MainForm::getForms()['DbStructure'], ]; } } diff --git a/libraries/classes/Config/Forms/Page/TableStructureForm.php b/libraries/classes/Config/Forms/Page/TableStructureForm.php index 80a59fa7a8..05af06458c 100644 --- a/libraries/classes/Config/Forms/Page/TableStructureForm.php +++ b/libraries/classes/Config/Forms/Page/TableStructureForm.php @@ -24,7 +24,7 @@ class TableStructureForm extends BaseForm public static function getForms() { return [ - 'TableStructure' => MainForm::getForms()['TableStructure'] + 'TableStructure' => MainForm::getForms()['TableStructure'], ]; } } diff --git a/libraries/classes/Config/Forms/Setup/ConfigForm.php b/libraries/classes/Config/Forms/Setup/ConfigForm.php index f5c14647d3..6fd451583e 100644 --- a/libraries/classes/Config/Forms/Setup/ConfigForm.php +++ b/libraries/classes/Config/Forms/Setup/ConfigForm.php @@ -25,7 +25,7 @@ class ConfigForm extends BaseForm return [ 'Config' => [ 'DefaultLang', - 'ServerDefault' + 'ServerDefault', ], ]; } diff --git a/libraries/classes/Config/Forms/Setup/FeaturesForm.php b/libraries/classes/Config/Forms/Setup/FeaturesForm.php index 325cc3efc1..49631dcc33 100644 --- a/libraries/classes/Config/Forms/Setup/FeaturesForm.php +++ b/libraries/classes/Config/Forms/Setup/FeaturesForm.php @@ -24,7 +24,10 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm /* Remove only_db/hide_db, we have proper Server form in setup */ $result['Databases'] = array_diff( $result['Databases'], - ['Servers/1/only_db', 'Servers/1/hide_db'] + [ + 'Servers/1/only_db', + 'Servers/1/hide_db', + ] ); /* Following are not available to user */ $result['Import_export'] = [ @@ -49,7 +52,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm 'LoginCookieStore', 'LoginCookieDeleteAll', 'CaptchaLoginPublicKey', - 'CaptchaLoginPrivateKey' + 'CaptchaLoginPrivateKey', ]; $result['Developer'] = [ 'UserprefsDeveloperTab', diff --git a/libraries/classes/Config/Forms/Setup/ServersForm.php b/libraries/classes/Config/Forms/Setup/ServersForm.php index a394fd43a1..60899c6a7c 100644 --- a/libraries/classes/Config/Forms/Setup/ServersForm.php +++ b/libraries/classes/Config/Forms/Setup/ServersForm.php @@ -31,9 +31,9 @@ class ServersForm extends BaseForm 'port', 'socket', 'ssl', - 'compress' - ] - ] + 'compress', + ], + ], ], 'Server_auth' => [ 'Servers' => [ @@ -49,9 +49,9 @@ class ServersForm extends BaseForm ':group:' . __('Signon authentication'), 'SignonSession', 'SignonURL', - 'LogoutURL' - ] - ] + 'LogoutURL', + ], + ], ], 'Server_config' => [ 'Servers' => [ @@ -63,9 +63,9 @@ class ServersForm extends BaseForm 'DisableIS', 'AllowDeny/order', 'AllowDeny/rules', - 'SessionTimeZone' - ] - ] + 'SessionTimeZone', + ], + ], ], 'Server_pmadb' => [ 'Servers' => [ @@ -95,8 +95,8 @@ class ServersForm extends BaseForm 'designer_settings' => 'pma__designer_settings', 'export_templates' => 'pma__export_templates', 'MaxTableUiprefs' => 100 - ] - ] + ], + ], ], 'Server_tracking' => [ 'Servers' => [ @@ -106,8 +106,8 @@ class ServersForm extends BaseForm 'tracking_add_drop_view', 'tracking_add_drop_table', 'tracking_add_drop_database', - ] - ] + ], + ], ], ]; } diff --git a/libraries/classes/Config/Forms/User/ExportForm.php b/libraries/classes/Config/Forms/User/ExportForm.php index d2897133eb..5c7bf15a66 100644 --- a/libraries/classes/Config/Forms/User/ExportForm.php +++ b/libraries/classes/Config/Forms/User/ExportForm.php @@ -97,7 +97,7 @@ class ExportForm extends BaseForm 'Export/excel_null', 'Export/excel_removeCRLF', 'Export/excel_columns', - 'Export/excel_edition' + 'Export/excel_edition', ], 'Latex' => [ 'Export/latex_caption', @@ -115,13 +115,13 @@ class ExportForm extends BaseForm 'Export/latex_data_caption', 'Export/latex_data_continued_caption', 'Export/latex_data_label', - 'Export/latex_null' + 'Export/latex_null', ], 'Microsoft_Office' => [ ':group:' . __('Microsoft Word 2000'), 'Export/htmlword_structure_or_data', 'Export/htmlword_null', - 'Export/htmlword_columns' + 'Export/htmlword_columns', ], 'Open_Document' => [ ':group:' . __('OpenDocument Spreadsheet'), @@ -137,13 +137,13 @@ class ExportForm extends BaseForm ':group:end', ':group:' . __('Data'), 'Export/odt_columns', - 'Export/odt_null' + 'Export/odt_null', ], 'Texy' => [ 'Export/texytext_structure_or_data', ':group:' . __('Data'), 'Export/texytext_null', - 'Export/texytext_columns' + 'Export/texytext_columns', ], ]; } diff --git a/libraries/classes/Config/Forms/User/FeaturesForm.php b/libraries/classes/Config/Forms/User/FeaturesForm.php index a7a671aad6..ce5c074272 100644 --- a/libraries/classes/Config/Forms/User/FeaturesForm.php +++ b/libraries/classes/Config/Forms/User/FeaturesForm.php @@ -49,19 +49,19 @@ class FeaturesForm extends BaseForm 'CharTextareaRows', 'TextareaCols', 'TextareaRows', - 'LongtextDoubleTextarea' + 'LongtextDoubleTextarea', ], 'Page_titles' => [ 'TitleDefault', 'TitleTable', 'TitleDatabase', - 'TitleServer' + 'TitleServer', ], 'Warnings' => [ 'PmaNoRelation_DisableWarning', 'SuhosinDisableWarning', 'LoginCookieValidityDisableWarning', - 'ReservedWordDisableWarning' + 'ReservedWordDisableWarning', ], 'Console' => [ 'Console/Mode', diff --git a/libraries/classes/Config/Forms/User/ImportForm.php b/libraries/classes/Config/Forms/User/ImportForm.php index 81351f31f6..c447567261 100644 --- a/libraries/classes/Config/Forms/User/ImportForm.php +++ b/libraries/classes/Config/Forms/User/ImportForm.php @@ -28,12 +28,12 @@ class ImportForm extends BaseForm 'Import/charset', 'Import/allow_interrupt', 'Import/skip_queries', - 'enable_drag_drop_import' + 'enable_drag_drop_import', ], 'Sql' => [ 'Import/sql_compatibility', 'Import/sql_no_auto_value_on_zero', - 'Import/sql_read_as_multibytes' + 'Import/sql_read_as_multibytes', ], 'Csv' => [ ':group:' . __('CSV'), @@ -50,14 +50,14 @@ class ImportForm extends BaseForm 'Import/ldi_terminated', 'Import/ldi_enclosed', 'Import/ldi_escaped', - 'Import/ldi_local_option' + 'Import/ldi_local_option', ], 'Open_Document' => [ ':group:' . __('OpenDocument Spreadsheet'), 'Import/ods_col_names', 'Import/ods_empty_rows', 'Import/ods_recognize_percentages', - 'Import/ods_recognize_currency' + 'Import/ods_recognize_currency', ], ]; diff --git a/libraries/classes/Config/Forms/User/MainForm.php b/libraries/classes/Config/Forms/User/MainForm.php index de6f3949d3..cc323ac325 100644 --- a/libraries/classes/Config/Forms/User/MainForm.php +++ b/libraries/classes/Config/Forms/User/MainForm.php @@ -26,14 +26,14 @@ class MainForm extends BaseForm 'Startup' => [ 'ShowCreateDb', 'ShowStats', - 'ShowServerInfo' + 'ShowServerInfo', ], 'DbStructure' => [ 'ShowDbStructureCharset', 'ShowDbStructureComment', 'ShowDbStructureCreation', 'ShowDbStructureLastUpdate', - 'ShowDbStructureLastCheck' + 'ShowDbStructureLastCheck', ], 'TableStructure' => [ 'HideStructureActions', @@ -48,7 +48,7 @@ class MainForm extends BaseForm 'DefaultTransformations/Inline', 'DefaultTransformations/TextImageLink', 'DefaultTransformations/TextLink', - ':group:end' + ':group:end', ], 'Browse' => [ 'TableNavigationLinksMode', @@ -66,7 +66,7 @@ class MainForm extends BaseForm 'RowActionLinksWithoutUnique', 'TablePrimaryKeyOrder', 'RememberSorting', - 'RelationalDisplay' + 'RelationalDisplay', ], 'Edit' => [ 'ProtectBinary', @@ -74,13 +74,13 @@ class MainForm extends BaseForm 'ShowFieldTypesInDataEditView', 'InsertRows', 'ForeignKeyDropdownOrder', - 'ForeignKeyMaxLimit' + 'ForeignKeyMaxLimit', ], 'Tabs' => [ 'TabsMode', 'DefaultTabServer', 'DefaultTabDatabase', - 'DefaultTabTable' + 'DefaultTabTable', ], 'DisplayRelationalSchema' => [ 'PDFDefaultPageSize' diff --git a/libraries/classes/Config/Forms/User/NaviForm.php b/libraries/classes/Config/Forms/User/NaviForm.php index 864c99da91..e2d373c538 100644 --- a/libraries/classes/Config/Forms/User/NaviForm.php +++ b/libraries/classes/Config/Forms/User/NaviForm.php @@ -45,7 +45,7 @@ class NaviForm extends BaseForm 'NavigationTreeShowFunctions', 'NavigationTreeShowProcedures', 'NavigationTreeShowEvents', - 'NavigationTreeAutoexpandSingleDb' + 'NavigationTreeAutoexpandSingleDb', ], 'Navi_servers' => [ 'NavigationDisplayServers', @@ -53,7 +53,7 @@ class NaviForm extends BaseForm ], 'Navi_databases' => [ 'NavigationTreeDisplayDbFilterMinimum', - 'NavigationTreeDbSeparator' + 'NavigationTreeDbSeparator', ], 'Navi_tables' => [ 'NavigationTreeDefaultTabTable', diff --git a/libraries/classes/Config/PageSettings.php b/libraries/classes/Config/PageSettings.php index 5e258973e3..965b240ebb 100644 --- a/libraries/classes/Config/PageSettings.php +++ b/libraries/classes/Config/PageSettings.php @@ -173,7 +173,7 @@ class PageSettings false, $response->getFooter()->getSelfUrl(), [ - 'submit_save' => $this->_groupName + 'submit_save' => $this->_groupName, ] ); $retval .= '</div>'; diff --git a/libraries/classes/Config/ServerConfigChecks.php b/libraries/classes/Config/ServerConfigChecks.php index 1657323736..cde0ccfba6 100644 --- a/libraries/classes/Config/ServerConfigChecks.php +++ b/libraries/classes/Config/ServerConfigChecks.php @@ -241,7 +241,11 @@ class ServerConfigChecks ); } } - return [$cookieAuthUsed, $blowfishSecret, $blowfishSecretSet]; + return [ + $cookieAuthUsed, + $blowfishSecret, + $blowfishSecretSet, + ]; } /** @@ -262,7 +266,10 @@ class ServerConfigChecks $blowfishSecretSet = true; $this->cfg->set('blowfish_secret', Util::generateRandom(32)); } - return [$blowfishSecret, $blowfishSecretSet]; + return [ + $blowfishSecret, + $blowfishSecretSet, + ]; } /** diff --git a/libraries/classes/Config/Validator.php b/libraries/classes/Config/Validator.php index 403a729d5c..833c1c46e8 100644 --- a/libraries/classes/Config/Validator.php +++ b/libraries/classes/Config/Validator.php @@ -318,7 +318,7 @@ class Validator $result = [ 'Server_pmadb' => '', 'Servers/1/controluser' => '', - 'Servers/1/controlpass' => '' + 'Servers/1/controlpass' => '', ]; $error = false; @@ -506,7 +506,7 @@ class Validator false, 65535, __('Not a valid port number!') - ) + ), ]; } @@ -528,7 +528,7 @@ class Validator false, PHP_INT_MAX, __('Not a positive number!') - ) + ), ]; } @@ -550,7 +550,7 @@ class Validator true, PHP_INT_MAX, __('Not a non-negative number!') - ) + ), ]; } @@ -589,7 +589,7 @@ class Validator $path => $result ? '' : sprintf( __('Value must be equal or lower than %s!'), $maxValue - ) + ), ]; } } diff --git a/libraries/classes/Controllers/Database/DatabaseStructureController.php b/libraries/classes/Controllers/Database/DatabaseStructureController.php index 40731b93e2..93865a077e 100644 --- a/libraries/classes/Controllers/Database/DatabaseStructureController.php +++ b/libraries/classes/Controllers/Database/DatabaseStructureController.php @@ -159,7 +159,7 @@ class DatabaseStructureController extends DatabaseController $uri = './db_structure.php' . Url::getCommonRaw([ 'db' => $this->db, 'pos' => max(0, $this->_total_num_tables - $GLOBALS['cfg']['MaxTableList']), - 'reload' => 1 + 'reload' => 1, ]); Core::sendHeaderLocation($uri); } @@ -187,7 +187,7 @@ class DatabaseStructureController extends DatabaseController $this->response->addHTML('<div id="tableslistcontainer">'); $_url_params = [ 'pos' => $this->_pos, - 'db' => $this->db + 'db' => $this->db, ]; // Add the sort options if they exists @@ -236,7 +236,7 @@ class DatabaseStructureController extends DatabaseController 'url_query' => Url::getCommon([ 'db' => $this->db, 'goto' => 'db_structure.php', - ]) + ]), ]) ); @@ -305,10 +305,11 @@ class DatabaseStructureController extends DatabaseController return; } // Check if current table is already in favorite list. - $favParams = ['db' => $this->db, + $favParams = [ + 'db' => $this->db, 'ajax_request' => true, 'favorite_table' => $favorite_table, - (($already_favorite ? 'remove' : 'add') . '_favorite') => true + (($already_favorite ? 'remove' : 'add') . '_favorite') => true, ]; $this->response->addJSON([ 'user' => $user, @@ -353,7 +354,7 @@ class DatabaseStructureController extends DatabaseController ->getRealRowCountTable(); $real_row_count_all[] = [ 'table' => $table['TABLE_NAME'], - 'row_count' => $row_count + 'row_count' => $row_count, ]; } @@ -440,7 +441,10 @@ class DatabaseStructureController extends DatabaseController $table_is_view = false; // Sets parameters for links $tbl_url_query = Url::getCommon( - ['db' => $this->db, 'table' => $current_table['TABLE_NAME']] + [ + 'db' => $this->db, + 'table' => $current_table['TABLE_NAME'], + ] ); // do not list the previous table's size info for a view @@ -789,7 +793,10 @@ class DatabaseStructureController extends DatabaseController } } - return [$approx_rows, $show_superscript]; + return [ + $approx_rows, + $show_superscript, + ]; } /** @@ -842,7 +849,10 @@ class DatabaseStructureController extends DatabaseController ); } - return [$do, $ignored]; + return [ + $do, + $ignored, + ]; } /** @@ -1017,8 +1027,15 @@ class DatabaseStructureController extends DatabaseController $table_is_view = true; } - return [$current_table, $formatted_size, $unit, $formatted_overhead, - $overhead_unit, $overhead_size, $table_is_view, $sum_size + return [ + $current_table, + $formatted_size, + $unit, + $formatted_overhead, + $overhead_unit, + $overhead_size, + $table_is_view, + $sum_size, ]; } @@ -1071,8 +1088,14 @@ class DatabaseStructureController extends DatabaseController $overhead_size += $current_table['Data_free']; } } - return [$current_table, $formatted_size, $unit, $formatted_overhead, - $overhead_unit, $overhead_size, $sum_size + return [ + $current_table, + $formatted_size, + $unit, + $formatted_overhead, + $overhead_unit, + $overhead_size, + $sum_size, ]; } @@ -1113,6 +1136,11 @@ class DatabaseStructureController extends DatabaseController ); } - return [$current_table, $formatted_size, $unit, $sum_size]; + return [ + $current_table, + $formatted_size, + $unit, + $sum_size, + ]; } } diff --git a/libraries/classes/Controllers/Server/ServerDatabasesController.php b/libraries/classes/Controllers/Server/ServerDatabasesController.php index f86b5e166e..041473dba4 100644 --- a/libraries/classes/Controllers/Server/ServerDatabasesController.php +++ b/libraries/classes/Controllers/Server/ServerDatabasesController.php @@ -262,7 +262,7 @@ class ServerDatabasesController extends Controller 'SCHEMA_DATA_LENGTH', 'SCHEMA_INDEX_LENGTH', 'SCHEMA_LENGTH', - 'SCHEMA_DATA_FREE' + 'SCHEMA_DATA_FREE', ]; if (in_array($_REQUEST['sort_by'], $sort_by_whitelist)) { $this->_sort_by = $_REQUEST['sort_by']; @@ -360,7 +360,10 @@ class ServerDatabasesController extends Controller $column_order = []; $column_order['DEFAULT_COLLATION_NAME'] = [ 'disp_name' => __('Collation'), - 'description_function' => [Charsets::class, 'getCollationDescr'], + 'description_function' => [ + Charsets::class, + 'getCollationDescr', + ], 'format' => 'string', 'footer' => '', ]; diff --git a/libraries/classes/Controllers/Server/ServerVariablesController.php b/libraries/classes/Controllers/Server/ServerVariablesController.php index 0f3e56b5cc..eff45d25df 100644 --- a/libraries/classes/Controllers/Server/ServerVariablesController.php +++ b/libraries/classes/Controllers/Server/ServerVariablesController.php @@ -185,7 +185,7 @@ class ServerVariablesController extends Controller 'mb' => 2, 'mib' => 2, 'gb' => 3, - 'gib' => 3 + 'gib' => 3, ]; $value = floatval($matches[1]) * pow( 1024, @@ -275,7 +275,7 @@ class ServerVariablesController extends Controller return [ $formattedValue, - $isHtmlFormatted + $isHtmlFormatted, ]; } @@ -369,7 +369,7 @@ class ServerVariablesController extends Controller 'is_html_formatted' => $isHtmlFormatted, 'has_session_value' => $has_session_value, 'session_value' => isset($sessionFormattedValue)?$sessionFormattedValue:null, - 'session_is_html_formated' => isset($sessionIsHtmlFormatted)?$sessionIsHtmlFormatted:null + 'session_is_html_formated' => isset($sessionIsHtmlFormatted)?$sessionIsHtmlFormatted:null, ]); } diff --git a/libraries/classes/Controllers/Table/TableChartController.php b/libraries/classes/Controllers/Table/TableChartController.php index faabf96be2..39c638a7e4 100644 --- a/libraries/classes/Controllers/Table/TableChartController.php +++ b/libraries/classes/Controllers/Table/TableChartController.php @@ -105,7 +105,7 @@ class TableChartController extends TableController 'vendor/jqplot/plugins/jqplot.pointLabels.js', 'vendor/jqplot/plugins/jqplot.pieRenderer.js', 'vendor/jqplot/plugins/jqplot.enhancedPieLegendRenderer.js', - 'vendor/jqplot/plugins/jqplot.highlighter.js' + 'vendor/jqplot/plugins/jqplot.highlighter.js', ] ); @@ -154,7 +154,10 @@ class TableChartController extends TableController $keys = array_keys($data[0]); - $numeric_types = ['int', 'real']; + $numeric_types = [ + 'int', + 'real', + ]; $numeric_column_count = 0; foreach ($keys as $idx => $key) { if (in_array($fields_meta[$idx]->type, $numeric_types)) { diff --git a/libraries/classes/Controllers/Table/TableRelationController.php b/libraries/classes/Controllers/Table/TableRelationController.php index f127a9d4ba..51c668c8c9 100644 --- a/libraries/classes/Controllers/Table/TableRelationController.php +++ b/libraries/classes/Controllers/Table/TableRelationController.php @@ -120,7 +120,7 @@ class TableRelationController extends TableController $this->response->getHeader()->getScripts()->addFiles( [ 'tbl_relation.js', - 'indexes.js' + 'indexes.js', ] ); diff --git a/libraries/classes/Controllers/Table/TableSearchController.php b/libraries/classes/Controllers/Table/TableSearchController.php index 09a95131a8..366b65698a 100644 --- a/libraries/classes/Controllers/Table/TableSearchController.php +++ b/libraries/classes/Controllers/Table/TableSearchController.php @@ -373,7 +373,7 @@ class TableSearchController extends TableController 'Browse' => Util::getIcon( 'b_browse', __('Browse foreign values') - ) + ), ]; $column_names_hashes = []; @@ -724,7 +724,18 @@ class TableSearchController extends TableController if (is_array($result)) { /* Iterate over possible delimiters to get one */ - $delimiters = ['/', '@', '#', '~', '!', '$', '%', '^', '&', '_']; + $delimiters = [ + '/', + '@', + '#', + '~', + '!', + '$', + '%', + '^', + '&', + '_', + ]; $found = false; for ($i = 0, $l = count($delimiters); $i < $l; $i++) { if (strpos($find, $delimiters[$i]) === false) { @@ -916,7 +927,7 @@ class TableSearchController extends TableController 'Browse' => Util::getIcon( 'b_browse', __('Browse foreign values') - ) + ), ]; //Gets column's type and collation $type = $this->_columnTypes[$column_index]; diff --git a/libraries/classes/Controllers/Table/TableStructureController.php b/libraries/classes/Controllers/Table/TableStructureController.php index a27b89df99..3d4b246630 100644 --- a/libraries/classes/Controllers/Table/TableStructureController.php +++ b/libraries/classes/Controllers/Table/TableStructureController.php @@ -156,7 +156,7 @@ class TableStructureController extends TableController $this->response->getHeader()->getScripts()->addFiles( [ 'tbl_structure.js', - 'indexes.js' + 'indexes.js', ] ); @@ -431,7 +431,10 @@ class TableStructureController extends TableController } $virtual = [ - 'VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED' + 'VIRTUAL', + 'PERSISTENT', + 'VIRTUAL GENERATED', + 'STORED GENERATED', ]; $data['Virtuality'] = ''; $data['Expression'] = ''; @@ -483,7 +486,7 @@ class TableStructureController extends TableController $this->response->addJSON( 'sql_data', $this->template->render('preview_sql', [ - 'query_data' => $sql_query + 'query_data' => $sql_query, ]) ); } else { // move column @@ -779,9 +782,14 @@ class TableStructureController extends TableController protected function getMultipleFieldCommandType() { $types = [ - 'change', 'drop', 'primary', - 'index', 'unique', 'spatial', - 'fulltext', 'browse' + 'change', + 'drop', + 'primary', + 'index', + 'unique', + 'spatial', + 'fulltext', + 'browse', ]; foreach ($types as $type) { @@ -870,7 +878,8 @@ class TableStructureController extends TableController { $err_url = 'tbl_structure.php' . Url::getCommon( [ - 'db' => $this->db, 'table' => $this->table + 'db' => $this->db, + 'table' => $this->table, ] ); $regenerate = false; @@ -1173,9 +1182,15 @@ class TableStructureController extends TableController } $fields = [ - 'field_attribute', 'field_collation', 'field_comments', - 'field_default_value', 'field_default_type', 'field_extra', - 'field_length', 'field_null', 'field_type' + 'field_attribute', + 'field_collation', + 'field_comments', + 'field_default_value', + 'field_default_type', + 'field_extra', + 'field_length', + 'field_null', + 'field_type', ]; foreach ($fields as $field) { if ($_POST[$field][$i] != $_POST[$field . '_orig'][$i]) { @@ -1608,8 +1623,11 @@ class TableStructureController extends TableController } return [ - $what, $query_type, $is_unset_submit_mult, $mult_btn, - $centralColsError + $what, + $query_type, + $is_unset_submit_mult, + $mult_btn, + $centralColsError, ]; } } diff --git a/libraries/classes/Core.php b/libraries/classes/Core.php index 8a902ce8f1..2c115f78d6 100644 --- a/libraries/classes/Core.php +++ b/libraries/classes/Core.php @@ -314,7 +314,18 @@ class Core { /* List of PHP documentation translations */ $php_doc_languages = [ - 'pt_BR', 'zh', 'fr', 'de', 'it', 'ja', 'pl', 'ro', 'ru', 'fa', 'es', 'tr' + 'pt_BR', + 'zh', + 'fr', + 'de', + 'it', + 'ja', + 'pl', + 'ro', + 'ru', + 'fa', + 'es', + 'tr', ]; $lang = 'en'; @@ -778,7 +789,11 @@ class Core return false; } // We do not want these to be present - $blocked = ['user', 'pass', 'port']; + $blocked = [ + 'user', + 'pass', + 'port', + ]; foreach ($blocked as $part) { if (isset($arr[$part]) && strlen((string) $arr[$part]) != 0) { return false; @@ -795,14 +810,17 @@ class Core 'demo.phpmyadmin.net', 'docs.phpmyadmin.net', /* mysql.com domains */ - 'dev.mysql.com','bugs.mysql.com', + 'dev.mysql.com', + 'bugs.mysql.com', /* mariadb domains */ - 'mariadb.org', 'mariadb.com', + 'mariadb.org', + 'mariadb.com', /* php.net domains */ 'php.net', 'secure.php.net', /* Github domains*/ - 'github.com','www.github.com', + 'github.com', + 'www.github.com', /* Percona domains */ 'www.percona.com', /* Following are doubtful ones. */ diff --git a/libraries/classes/CreateAddField.php b/libraries/classes/CreateAddField.php index ef0c6021b6..230f8615d1 100644 --- a/libraries/classes/CreateAddField.php +++ b/libraries/classes/CreateAddField.php @@ -551,6 +551,9 @@ class CreateAddField if (isset($_POST['preview_sql'])) { Core::previewSQL($sqlQuery); } - return [$this->dbi->tryQuery($sqlQuery), $sqlQuery]; + return [ + $this->dbi->tryQuery($sqlQuery), + $sqlQuery, + ]; } } diff --git a/libraries/classes/Database/Designer/Common.php b/libraries/classes/Database/Designer/Common.php index 837a1131d3..64b32a4f8d 100644 --- a/libraries/classes/Database/Designer/Common.php +++ b/libraries/classes/Database/Designer/Common.php @@ -209,7 +209,7 @@ class Common $retval[$ti][$c_name_i][$dtn_i] = []; $retval[$ti][$c_name_i][$dtn_i][$con['DCN'][$i]] = [ 0 => $con['STN'][$i], - 1 => $con['SCN'][$i] + 1 => $con['SCN'][$i], ]; } $ti++; @@ -263,7 +263,7 @@ class Common { $retval = [ 'j_tabs' => [], - 'h_tabs' => [] + 'h_tabs' => [], ]; for ($i = 0, $cnt = count($GLOBALS['designer']['TABLE_NAME']); $i < $cnt; $i++) { @@ -587,7 +587,10 @@ class Common if ($foreigner && isset($foreigner['constraint']) ) { - return [false, __('Error: relationship already exists.')]; + return [ + false, + __('Error: relationship already exists.'), + ]; } // note: in InnoDB, the index does not requires to be on a PRIMARY // or UNIQUE key @@ -633,23 +636,32 @@ class Common } $upd_query .= ';'; if ($this->dbi->tryQuery($upd_query)) { - return [true, __('FOREIGN KEY relationship has been added.')]; + return [ + true, + __('FOREIGN KEY relationship has been added.'), + ]; } $error = $this->dbi->getError(); return [ false, __('Error: FOREIGN KEY relationship could not be added!') - . "<br>" . $error + . "<br>" . $error, ]; } - return [false, __('Error: Missing index on column(s).')]; + return [ + false, + __('Error: Missing index on column(s).'), + ]; } // internal (pmadb) relation if ($GLOBALS['cfgRelation']['relwork'] == false) { - return [false, __('Error: Relational features are disabled!')]; + return [ + false, + __('Error: Relational features are disabled!'), + ]; } // no need to recheck if the keys are primary or unique at this point, @@ -671,14 +683,17 @@ class Common if ($this->relation->queryAsControlUser($q, false, DatabaseInterface::QUERY_STORE) ) { - return [true, __('Internal relationship has been added.')]; + return [ + true, + __('Internal relationship has been added.'), + ]; } $error = $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL); return [ false, __('Error: Internal relationship could not be added!') - . "<br>" . $error + . "<br>" . $error, ]; } @@ -715,14 +730,17 @@ class Common . '.' . Util::backquote($T2) . ' DROP FOREIGN KEY ' . Util::backquote($foreigner['constraint']) . ';'; if ($this->dbi->query($upd_query)) { - return [true, __('FOREIGN KEY relationship has been removed.')]; + return [ + true, + __('FOREIGN KEY relationship has been removed.'), + ]; } $error = $this->dbi->getError(); return [ false, __('Error: FOREIGN KEY relationship could not be removed!') - . "<br>" . $error + . "<br>" . $error, ]; } } @@ -748,11 +766,14 @@ class Common $error = $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL); return [ false, - __('Error: Internal relationship could not be removed!') . "<br>" . $error + __('Error: Internal relationship could not be removed!') . "<br>" . $error, ]; } - return [true, __('Internal relationship has been removed.')]; + return [ + true, + __('Internal relationship has been removed.'), + ]; } /** @@ -769,7 +790,7 @@ class Common $cfgDesigner = [ 'user' => $GLOBALS['cfg']['Server']['user'], 'db' => $cfgRelation['db'], - 'table' => $cfgRelation['designer_settings'] + 'table' => $cfgRelation['designer_settings'], ]; $success = true; diff --git a/libraries/classes/Database/Qbe.php b/libraries/classes/Database/Qbe.php index 98099f9fde..621248e32f 100644 --- a/libraries/classes/Database/Qbe.php +++ b/libraries/classes/Database/Qbe.php @@ -1496,7 +1496,7 @@ class Qbe } // end for return [ 'where_clause_tables' => $where_clause_tables, - 'where_clause_columns' => $where_clause_columns + 'where_clause_columns' => $where_clause_columns, ]; } @@ -1958,19 +1958,31 @@ class Qbe if (isset($unique_columns) && count($unique_columns) > 0) { $candidate_columns = $unique_columns; $needsort = 1; - return [$candidate_columns, $needsort]; + return [ + $candidate_columns, + $needsort, + ]; } elseif (isset($index_columns) && count($index_columns) > 0) { $candidate_columns = $index_columns; $needsort = 1; - return [$candidate_columns, $needsort]; + return [ + $candidate_columns, + $needsort, + ]; } elseif (isset($where_clause_columns) && count($where_clause_columns) > 0) { $candidate_columns = $where_clause_columns; $needsort = 0; - return [$candidate_columns, $needsort]; + return [ + $candidate_columns, + $needsort, + ]; } $candidate_columns = $search_tables; $needsort = 0; - return [$candidate_columns, $needsort]; + return [ + $candidate_columns, + $needsort, + ]; } } diff --git a/libraries/classes/Database/Search.php b/libraries/classes/Database/Search.php index 69396af444..6a5054f8a5 100644 --- a/libraries/classes/Database/Search.php +++ b/libraries/classes/Database/Search.php @@ -330,7 +330,7 @@ class Search ), '3' => $this->searchTypes[3], '4' => $this->searchTypes[4], - '5' => $this->searchTypes[5] . ' ' . Util::showMySQLDocu('Regexp') + '5' => $this->searchTypes[5] . ' ' . Util::showMySQLDocu('Regexp'), ]; return $this->template->render('database/search/main', [ 'db' => $this->db, diff --git a/libraries/classes/DatabaseInterface.php b/libraries/classes/DatabaseInterface.php index 071a6e976e..ebb9a24080 100644 --- a/libraries/classes/DatabaseInterface.php +++ b/libraries/classes/DatabaseInterface.php @@ -449,7 +449,10 @@ class DatabaseInterface . implode( '\', \'', array_map( - [$this, 'escapeString'], + [ + $this, + 'escapeString', + ], $table ) ) @@ -584,7 +587,10 @@ class DatabaseInterface // comparison (if we are looking for the db Aa we don't want // to find the db aa) $this_databases = array_map( - [$this, 'escapeString'], + [ + $this, + 'escapeString', + ], $databases ); @@ -599,7 +605,10 @@ class DatabaseInterface $tables = $this->fetchResult( $sql, - ['TABLE_SCHEMA', 'TABLE_NAME'], + [ + 'TABLE_SCHEMA', + 'TABLE_NAME', + ], null, $link ); @@ -652,7 +661,10 @@ class DatabaseInterface . implode( '\', \'', array_map( - [$this, 'escapeString'], + [ + $this, + 'escapeString', + ], $table, $link ) @@ -1027,7 +1039,10 @@ class DatabaseInterface $GLOBALS['callback_sort_by'] = $sort_by; usort( $databases, - [self::class, '_usortComparisonCallback'] + [ + self::class, + '_usortComparisonCallback', + ] ); unset($GLOBALS['callback_sort_order'], $GLOBALS['callback_sort_by']); @@ -1977,7 +1992,7 @@ class DatabaseInterface 'PROCEDURE' => 'Create Procedure', 'FUNCTION' => 'Create Function', 'EVENT' => 'Create Event', - 'VIEW' => 'Create View' + 'VIEW' => 'Create View', ]; $query = 'SHOW CREATE ' . $which . ' ' . Util::backquote($db) . '.' @@ -2019,7 +2034,7 @@ class DatabaseInterface . " FROM `information_schema`.`ROUTINES`" . " WHERE `ROUTINE_SCHEMA` " . Util::getCollateForIS() . " = '" . $GLOBALS['dbi']->escapeString($db) . "'"; - if (Core::isValid($which, ['FUNCTION','PROCEDURE'])) { + if (Core::isValid($which, ['FUNCTION', 'PROCEDURE'])) { $query .= " AND `ROUTINE_TYPE` = '" . $which . "'"; } if (! empty($name)) { @@ -2266,7 +2281,10 @@ class DatabaseInterface $error .= ' - ' . $error_message . ' (<a href="server_engines.php' . Url::getCommon( - ['engine' => 'InnoDB', 'page' => 'Status'] + [ + 'engine' => 'InnoDB', + 'page' => 'Status' + ] ) . '">' . __('Details…') . '</a>)'; } } else { @@ -2434,7 +2452,10 @@ class DatabaseInterface public function getSystemSchemas(): array { $schemas = [ - 'information_schema', 'performance_schema', 'mysql', 'sys' + 'information_schema', + 'performance_schema', + 'mysql', + 'sys', ]; $systemSchemas = []; foreach ($schemas as $schema) { @@ -2499,9 +2520,16 @@ class DatabaseInterface // Share the settings if the host is same if ($server['host'] == $cfg['Server']['host']) { $shared = [ - 'port', 'socket', 'compress', - 'ssl', 'ssl_key', 'ssl_cert', 'ssl_ca', - 'ssl_ca_path', 'ssl_ciphers', 'ssl_verify', + 'port', + 'socket', + 'compress', + 'ssl', + 'ssl_key', + 'ssl_cert', + 'ssl_ca', + 'ssl_ca_path', + 'ssl_ciphers', + 'ssl_verify', ]; foreach ($shared as $item) { if (isset($cfg['Server'][$item])) { @@ -2521,7 +2549,11 @@ class DatabaseInterface } } else { if (is_null($server)) { - return [null, null, null]; + return [ + null, + null, + null, + ]; } if (isset($server['user'])) { $user = $server['user']; @@ -2550,7 +2582,11 @@ class DatabaseInterface $server['compress'] = false; } - return [$user, $password, $server]; + return [ + $user, + $password, + $server, + ]; } /** diff --git a/libraries/classes/Dbi/DbiDummy.php b/libraries/classes/Dbi/DbiDummy.php index ea5492fd11..7fb3337492 100644 --- a/libraries/classes/Dbi/DbiDummy.php +++ b/libraries/classes/Dbi/DbiDummy.php @@ -474,14 +474,22 @@ class DbiDummy implements DbiExtension * Array of queries this "driver" supports */ $GLOBALS['dummy_queries'] = [ - ['query' => 'SELECT 1', 'result' => [['1']]], + [ + 'query' => 'SELECT 1', + 'result' => [['1']], + ], [ 'query' => 'SELECT CURRENT_USER();', 'result' => [['pma_test@localhost']], ], [ 'query' => "SHOW VARIABLES LIKE 'lower_case_table_names'", - 'result' => [['lower_case_table_names', '1']], + 'result' => [ + [ + 'lower_case_table_names', + '1', + ], + ], ], [ 'query' => 'SELECT 1 FROM mysql.user LIMIT 1', @@ -535,20 +543,62 @@ class DbiDummy implements DbiExtension . ' LIKE \'Innodb\\_buffer\\_pool\\_%\'' . ' OR Variable_name = \'Innodb_page_size\';', 'result' => [ - ['Innodb_buffer_pool_pages_data', 0], - ['Innodb_buffer_pool_pages_dirty', 0], - ['Innodb_buffer_pool_pages_flushed', 0], - ['Innodb_buffer_pool_pages_free', 0], - ['Innodb_buffer_pool_pages_misc', 0], - ['Innodb_buffer_pool_pages_total', 4096], - ['Innodb_buffer_pool_read_ahead_rnd', 0], - ['Innodb_buffer_pool_read_ahead', 0], - ['Innodb_buffer_pool_read_ahead_evicted', 0], - ['Innodb_buffer_pool_read_requests', 64], - ['Innodb_buffer_pool_reads', 32], - ['Innodb_buffer_pool_wait_free', 0], - ['Innodb_buffer_pool_write_requests', 64], - ['Innodb_page_size', 16384], + [ + 'Innodb_buffer_pool_pages_data', + 0, + ], + [ + 'Innodb_buffer_pool_pages_dirty', + 0, + ], + [ + 'Innodb_buffer_pool_pages_flushed', + 0, + ], + [ + 'Innodb_buffer_pool_pages_free', + 0, + ], + [ + 'Innodb_buffer_pool_pages_misc', + 0, + ], + [ + 'Innodb_buffer_pool_pages_total', + 4096, + ], + [ + 'Innodb_buffer_pool_read_ahead_rnd', + 0, + ], + [ + 'Innodb_buffer_pool_read_ahead', + 0, + ], + [ + 'Innodb_buffer_pool_read_ahead_evicted', + 0, + ], + [ + 'Innodb_buffer_pool_read_requests', + 64, + ], + [ + 'Innodb_buffer_pool_reads', + 32, + ], + [ + 'Innodb_buffer_pool_wait_free', + 0, + ], + [ + 'Innodb_buffer_pool_write_requests', + 64, + ], + [ + 'Innodb_page_size', + 16384, + ], ], ], [ @@ -570,13 +620,19 @@ class DbiDummy implements DbiExtension [ 'query' => 'SHOW GLOBAL VARIABLES LIKE \'innodb_file_per_table\';', 'result' => [ - ['innodb_file_per_table', 'OFF'], + [ + 'innodb_file_per_table', + 'OFF', + ], ], ], [ 'query' => 'SHOW GLOBAL VARIABLES LIKE \'innodb_file_format\';', 'result' => [ - ['innodb_file_format', 'Antelope'], + [ + 'innodb_file_format', + 'Antelope', + ], ], ], [ @@ -592,7 +648,10 @@ class DbiDummy implements DbiExtension [ 'query' => 'SHOW SESSION VARIABLES LIKE \'FOREIGN_KEY_CHECKS\';', 'result' => [ - ['foreign_key_checks', 'ON'], + [ + 'foreign_key_checks', + 'ON', + ], ], ], [ @@ -619,8 +678,22 @@ class DbiDummy implements DbiExtension 'Extra', ], 'result' => [ - ['i', 'int(11)', 'NO', 'PRI', 'NULL', 'auto_increment'], - ['o', 'int(11)', 'NO', 'MUL', 'NULL', ''], + [ + 'i', + 'int(11)', + 'NO', + 'PRI', + 'NULL', + 'auto_increment', + ], + [ + 'o', + 'int(11)', + 'NO', + 'MUL', + 'NULL', + '', + ], ], ], [ @@ -638,8 +711,22 @@ class DbiDummy implements DbiExtension 'Extra', ], 'result' => [ - ['i', 'int(11)', 'NO', 'PRI', 'NULL', 'auto_increment'], - ['o', 'int(11)', 'NO', 'MUL', 'NULL', ''], + [ + 'i', + 'int(11)', + 'NO', + 'PRI', + 'NULL', + 'auto_increment', + ], + [ + 'o', + 'int(11)', + 'NO', + 'MUL', + 'NULL', + '', + ], ], ], [ @@ -694,8 +781,14 @@ class DbiDummy implements DbiExtension 'Description', ], 'result' => [ - ['utf8', 'UTF-8 Unicode'], - ['latin1', 'cp1252 West European'], + [ + 'utf8', + 'UTF-8 Unicode', + ], + [ + 'latin1', + 'cp1252 West European', + ], ], ], [ @@ -708,9 +801,21 @@ class DbiDummy implements DbiExtension 'Default', ], 'result' => [ - ['utf8', 'utf8_general_ci','Yes'], - ['utf8', 'utf8_bin', ''], - ['latin1', 'latin1_swedish_ci', 'Yes'], + [ + 'utf8', + 'utf8_general_ci', + 'Yes', + ], + [ + 'utf8', + 'utf8_bin', + '', + ], + [ + 'latin1', + 'latin1_swedish_ci', + 'Yes', + ], ], ], [ @@ -737,8 +842,22 @@ class DbiDummy implements DbiExtension 'input_transformation_options', ], 'result' => [ - ['o', 'text/plain', 'sql', '', 'regex', '/pma/i'], - ['col', 't', 'o/p', '', 'i/p', ''], + [ + 'o', + 'text/plain', + 'sql', + '', + 'regex', + '/pma/i', + ], + [ + 'col', + 't', + 'o/p', + '', + 'i/p', + '', + ], ], ], [ @@ -1163,8 +1282,14 @@ class DbiDummy implements DbiExtension [ 'query' => "SHOW FULL TABLES FROM `default` WHERE `Table_type`='BASE TABLE'", 'result' => [ - ["test1", "BASE TABLE"], - ["test2", "BASE TABLE"], + [ + "test1", + "BASE TABLE", + ], + [ + "test2", + "BASE TABLE", + ], ], ], [ @@ -1207,28 +1332,28 @@ class DbiDummy implements DbiExtension [ 'query' => 'DELETE FROM `mysql`.`db` WHERE `host` = "" ' . 'AND `Db` = "" AND `User` = ""', - 'result' => true + 'result' => true, ], [ 'query' => 'DELETE FROM `mysql`.`columns_priv` WHERE ' . '`host` = "" AND `Db` = "" AND `User` = ""', - 'result' => true + 'result' => true, ], [ 'query' => 'DELETE FROM `mysql`.`tables_priv` WHERE ' . '`host` = "" AND `Db` = "" AND `User` = "" AND Table_name = ""', - 'result' => true + 'result' => true, ], [ 'query' => 'DELETE FROM `mysql`.`procs_priv` WHERE ' . '`host` = "" AND `Db` = "" AND `User` = "" AND `Routine_name` = "" ' . 'AND `Routine_type` = ""', - 'result' => true + 'result' => true, ], [ 'query' => 'SELECT `plugin` FROM `mysql`.`user` WHERE ' . '`User` = "pma_username" AND `Host` = "pma_hostname" LIMIT 1', - 'result' => [] + 'result' => [], ], [ 'query' => 'SELECT @@default_authentication_plugin', @@ -1363,7 +1488,7 @@ class DbiDummy implements DbiExtension '3844432963', 'row_format=REDUNDANT', 'Test comment for "table1" in \'pma_test\'', - ] + ], ], ], [ @@ -1410,7 +1535,7 @@ class DbiDummy implements DbiExtension '3844432963', 'row_format=REDUNDANT', 'Test comment for "table1" in \'pma_test\'', - ] + ], ], ], [ @@ -1420,7 +1545,7 @@ class DbiDummy implements DbiExtension 'BIN_NAME' => 'pma_test', 'DEFAULT_COLLATION_NAME' => 'utf8mb4_general_ci', 'SCHEMA_NAME' => 'pma_test', - ] + ], ], ], [ @@ -1489,7 +1614,7 @@ class DbiDummy implements DbiExtension 'COLUMN_NAME' => 'idtable2', 'REFERENCED_TABLE_NAME' => 'table1', 'REFERENCED_COLUMN_NAME' => 'idtable1', - ] + ], ], ], diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php index 1851a15e4a..d25837c344 100644 --- a/libraries/classes/Display/Export.php +++ b/libraries/classes/Display/Export.php @@ -618,7 +618,10 @@ class Export // Empty row for javascript manipulations $result .= '</tbody><tfoot class="hide">' . $template->render([ - 'type' => '', 'name' => '', 'field' => 'aliases_new', 'value' => '' + 'type' => '', + 'name' => '', + 'field' => 'aliases_new', + 'value' => '', ]) . '</tfoot>'; return $result . '</table>'; @@ -681,7 +684,7 @@ class Export 'libraries/classes/Plugins/Export/', [ 'export_type' => $exportType, - 'single_table' => isset($GLOBALS['single_table']) + 'single_table' => isset($GLOBALS['single_table']), ] ); diff --git a/libraries/classes/Display/ImportAjax.php b/libraries/classes/Display/ImportAjax.php index afaee5aea2..055bf7c686 100644 --- a/libraries/classes/Display/ImportAjax.php +++ b/libraries/classes/Display/ImportAjax.php @@ -48,7 +48,7 @@ class ImportAjax //"session", "progress", "apc", - "noplugin" + "noplugin", ]; // select available plugin @@ -63,7 +63,11 @@ class ImportAjax break; } } - return [$SESSION_KEY, $upload_id, $plugins]; + return [ + $SESSION_KEY, + $upload_id, + $plugins, + ]; } /** diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 6d06da9c8d..195999ad95 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -268,51 +268,51 @@ class Results $json_highlighting_data = [ 'libraries/classes/Plugins/Transformations/Output/Text_Plain_Json.php', 'PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Json', - 'Text_Plain' + 'Text_Plain', ]; $sql_highlighting_data = [ 'libraries/classes/Plugins/Transformations/Output/Text_Plain_Sql.php', 'PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Sql', - 'Text_Plain' + 'Text_Plain', ]; $blob_sql_highlighting_data = [ 'libraries/classes/Plugins/Transformations/Output/Text_Octetstream_Sql.php', 'PhpMyAdmin\Plugins\Transformations\Output\Text_Octetstream_Sql', - 'Text_Octetstream' + 'Text_Octetstream', ]; $link_data = [ 'libraries/classes/Plugins/Transformations/Text_Plain_Link.php', 'PhpMyAdmin\Plugins\Transformations\Text_Plain_Link', - 'Text_Plain' + 'Text_Plain', ]; $this->transformation_info = [ 'information_schema' => [ 'events' => [ - 'event_definition' => $sql_highlighting_data + 'event_definition' => $sql_highlighting_data, ], 'processlist' => [ - 'info' => $sql_highlighting_data + 'info' => $sql_highlighting_data, ], 'routines' => [ - 'routine_definition' => $sql_highlighting_data + 'routine_definition' => $sql_highlighting_data, ], 'triggers' => [ - 'action_statement' => $sql_highlighting_data + 'action_statement' => $sql_highlighting_data, ], 'views' => [ - 'view_definition' => $sql_highlighting_data + 'view_definition' => $sql_highlighting_data, ] ], 'mysql' => [ 'event' => [ 'body' => $blob_sql_highlighting_data, - 'body_utf8' => $blob_sql_highlighting_data + 'body_utf8' => $blob_sql_highlighting_data, ], 'general_log' => [ - 'argument' => $sql_highlighting_data + 'argument' => $sql_highlighting_data, ], 'help_category' => [ - 'url' => $link_data + 'url' => $link_data, ], 'help_topic' => [ 'example' => $sql_highlighting_data, @@ -325,7 +325,7 @@ class Results 'body_utf8' => $blob_sql_highlighting_data ], 'slow_log' => [ - 'sql_text' => $sql_highlighting_data + 'sql_text' => $sql_highlighting_data, ] ] ]; @@ -336,12 +336,12 @@ class Results $relDb = &$this->transformation_info[$cfgRelation['db']]; if (! empty($cfgRelation['history'])) { $relDb[$cfgRelation['history']] = [ - 'sqlquery' => $sql_highlighting_data + 'sqlquery' => $sql_highlighting_data, ]; } if (! empty($cfgRelation['bookmark'])) { $relDb[$cfgRelation['bookmark']] = [ - 'query' => $sql_highlighting_data + 'query' => $sql_highlighting_data, ]; } if (! empty($cfgRelation['tracking'])) { @@ -352,37 +352,37 @@ class Results } if (! empty($cfgRelation['favorite'])) { $relDb[$cfgRelation['favorite']] = [ - 'tables' => $json_highlighting_data + 'tables' => $json_highlighting_data, ]; } if (! empty($cfgRelation['recent'])) { $relDb[$cfgRelation['recent']] = [ - 'tables' => $json_highlighting_data + 'tables' => $json_highlighting_data, ]; } if (! empty($cfgRelation['savedsearches'])) { $relDb[$cfgRelation['savedsearches']] = [ - 'search_data' => $json_highlighting_data + 'search_data' => $json_highlighting_data, ]; } if (! empty($cfgRelation['designer_settings'])) { $relDb[$cfgRelation['designer_settings']] = [ - 'settings_data' => $json_highlighting_data + 'settings_data' => $json_highlighting_data, ]; } if (! empty($cfgRelation['table_uiprefs'])) { $relDb[$cfgRelation['table_uiprefs']] = [ - 'prefs' => $json_highlighting_data + 'prefs' => $json_highlighting_data, ]; } if (! empty($cfgRelation['userconfig'])) { $relDb[$cfgRelation['userconfig']] = [ - 'config_data' => $json_highlighting_data + 'config_data' => $json_highlighting_data, ]; } if (! empty($cfgRelation['export_templates'])) { $relDb[$cfgRelation['export_templates']] = [ - 'template_data' => $json_highlighting_data + 'template_data' => $json_highlighting_data, ]; } } @@ -703,7 +703,10 @@ class Results } } // end if (3) - return [$displayParts, $the_total]; + return [ + $displayParts, + $the_total, + ]; } // end of the 'setDisplayPartsAndTotal()' function @@ -845,7 +848,10 @@ class Results $table_navigation_html .= '</form>' . '</td>'; } - return [$table_navigation_html, $nbTotalPage]; + return [ + $table_navigation_html, + $nbTotalPage, + ]; } /** @@ -1165,7 +1171,7 @@ class Results '50' => 50, '100' => 100, '250' => 250, - '500' => 500 + '500' => 500, ]; return $this->template->render('display/results/additional_fields', [ @@ -1449,7 +1455,10 @@ class Results } } - return [$unsorted_sql_query, $drop_down_html]; + return [ + $unsorted_sql_query, + $drop_down_html, + ]; } // end of the '_getUnsortedSqlAndSortByKeyDropDown()' function /** @@ -1615,7 +1624,10 @@ class Results $this->__set('display_params', $display_params); - return [$colspan, $button_html]; + return [ + $colspan, + $button_html, + ]; } // end of the '_getFieldVisibilityParams()' function @@ -1781,7 +1793,7 @@ class Results 'table' => $this->__get('table'), 'sql_query' => $this->__get('sql_query'), 'goto' => $this->__get('goto'), - 'full_text_button' => 1 + 'full_text_button' => 1, ]; if ($_SESSION['tmpval']['pftext'] == self::DISPLAY_FULL_TEXT) { @@ -1960,7 +1972,10 @@ class Results $comments ); - return [$order_link, $sorted_header_html]; + return [ + $order_link, + $sorted_header_html, + ]; } // end of the '_getOrderLinkAndSortedHeaderHtml()' function /** @@ -2105,7 +2120,11 @@ class Results if (empty($order_img)) { $order_img = ''; } - return [$single_sort_order, $sort_order, $order_img]; + return [ + $single_sort_order, + $sort_order, + $order_img, + ]; } /** @@ -2209,27 +2228,42 @@ class Results $order_img = ' ' . Util::getImage( 's_desc', __('Descending'), - ['class' => "soimg", 'title' => ''] + [ + 'class' => "soimg", + 'title' => '', + ] ); $order_img .= ' ' . Util::getImage( 's_asc', __('Ascending'), - ['class' => "soimg hide", 'title' => ''] + [ + 'class' => "soimg hide", + 'title' => '', + ] ); } else { $sort_order .= ' DESC'; $order_img = ' ' . Util::getImage( 's_asc', __('Ascending'), - ['class' => "soimg", 'title' => ''] + [ + 'class' => "soimg", + 'title' => '', + ] ); $order_img .= ' ' . Util::getImage( 's_desc', __('Descending'), - ['class' => "soimg hide", 'title' => ''] + [ + 'class' => "soimg hide", + 'title' => '', + ] ); } - return [$sort_order, $order_img]; + return [ + $sort_order, + $order_img, + ]; } // end of the '_getSortingUrlParams()' function @@ -2254,7 +2288,7 @@ class Results $multi_order_url ) { $order_link_params = [ - 'class' => 'sortlink' + 'class' => 'sortlink', ]; $order_link_content = htmlspecialchars($fields_meta->name); @@ -3018,7 +3052,10 @@ class Results : false; // Wrap MIME-transformations. [MIME] - $default_function = [Core::class, 'mimeDefaultFunction']; // default_function + $default_function = [ + Core::class, + 'mimeDefaultFunction', + ]; // default_function $transformation_plugin = $default_function; $transform_options = []; @@ -3042,11 +3079,9 @@ class Results $transform_options = $this->transformations->getOptions( isset( - $mime_map[$orgFullColName] - ['transformation_options'] + $mime_map[$orgFullColName]['transformation_options'] ) - ? $mime_map[$orgFullColName] - ['transformation_options'] + ? $mime_map[$orgFullColName]['transformation_options'] : '' ); @@ -3069,10 +3104,8 @@ class Results && (trim($row[$i]) != '') && ! $_SESSION['tmpval']['hide_transformation'] ) { - include_once $this->transformation_info - [$dbLower][$tblLower][$nameLower][0]; - $transformation_plugin = new $this->transformation_info - [$dbLower][$tblLower][$nameLower][1](null); + include_once $this->transformation_info[$dbLower][$tblLower][$nameLower][0]; + $transformation_plugin = new $this->transformation_info[$dbLower][$tblLower][$nameLower][1](null); $transform_options = $this->transformations->getOptions( isset($mime_map[$orgFullColName]['transformation_options']) @@ -3083,9 +3116,7 @@ class Results $meta->mimetype = str_replace( '_', '/', - $this->transformation_info[$dbLower] - [mb_strtolower($meta->orgtable)] - [mb_strtolower($meta->orgname)][2] + $this->transformation_info[$dbLower][mb_strtolower($meta->orgtable)][mb_strtolower($meta->orgname)][2] ); } @@ -3104,7 +3135,7 @@ class Results $transform_options = [ 0 => $linking_url, - 2 => true + 2 => true, ]; $meta->mimetype = str_replace( @@ -3138,7 +3169,7 @@ class Results 'db' => $this->__get('db'), 'table' => $meta->orgtable, 'where_clause' => $whereClauseMap[$row_no][$meta->orgtable], - 'transform_key' => $meta->orgname + 'transform_key' => $meta->orgname, ]; if (! empty($sql_query)) { @@ -3240,10 +3271,7 @@ class Results { $linking_url_params = []; - $link_relations = $GLOBALS['special_schema_links'] - [mb_strtolower($this->__get('db'))] - [mb_strtolower($this->__get('table'))] - [$field_name]; + $link_relations = $GLOBALS['special_schema_links'][mb_strtolower($this->__get('db'))][mb_strtolower($this->__get('table'))][$field_name]; if (! is_array($link_relations['link_param'])) { $linking_url_params[$link_relations['link_param']] = $column_value; @@ -3380,7 +3408,10 @@ class Results $col_visib = false; } - return [$col_order, $col_visib]; + return [ + $col_order, + $col_visib, + ]; } // end of the '_getColumnParams()' function @@ -3478,7 +3509,13 @@ class Results $edit_anchor_class .= ' nonunique'; } - return [$edit_url, $copy_url, $edit_str, $copy_str, $edit_anchor_class]; + return [ + $edit_url, + $copy_url, + $edit_str, + $copy_str, + $edit_anchor_class, + ]; } // end of the '_getModifiedLinks()' function @@ -3566,7 +3603,11 @@ class Results $del_url = $del_str = $js_conf = null; } - return [$del_url, $del_str, $js_conf]; + return [ + $del_url, + $del_str, + $js_conf, + ]; } // end of the '_getDeleteAndKillLinks()' function @@ -4190,7 +4231,8 @@ class Results if (Core::isValid( $_REQUEST['pftext'], [ - self::DISPLAY_PARTIAL_TEXT, self::DISPLAY_FULL_TEXT + self::DISPLAY_PARTIAL_TEXT, + self::DISPLAY_FULL_TEXT, ] ) ) { @@ -4203,7 +4245,8 @@ class Results if (Core::isValid( $_REQUEST['relational_display'], [ - self::RELATIONAL_KEY, self::RELATIONAL_DISPLAY_COLUMN + self::RELATIONAL_KEY, + self::RELATIONAL_DISPLAY_COLUMN, ] ) ) { @@ -4219,8 +4262,9 @@ class Results if (Core::isValid( $_REQUEST['geoOption'], [ - self::GEOMETRY_DISP_WKT, self::GEOMETRY_DISP_WKB, - self::GEOMETRY_DISP_GEOM + self::GEOMETRY_DISP_WKT, + self::GEOMETRY_DISP_WKB, + self::GEOMETRY_DISP_GEOM, ] ) ) { @@ -4486,7 +4530,7 @@ class Results $this->__get('table'), $fields_meta[1]->name, '', - $this->__get('db') + $this->__get('db'), ]; } } // end if @@ -4585,7 +4629,10 @@ class Results } } - return [$pos_next, $pos_prev]; + return [ + $pos_next, + $pos_prev, + ]; } // end of the '_getOffsets()' function @@ -4645,7 +4692,10 @@ class Results $row = $GLOBALS['dbi']->fetchRow($dt_result); // initializing default arguments - $default_function = [Core::class, 'mimeDefaultFunction']; + $default_function = [ + Core::class, + 'mimeDefaultFunction', + ]; $transformation_plugin = $default_function; $transform_options = []; @@ -4859,7 +4909,7 @@ class Results $rel['foreign_table'], $rel['foreign_field'], $display_field, - $rel['foreign_db'] + $rel['foreign_db'], ]; } else { foreach ($rel as $key => $one_key) { @@ -4877,7 +4927,7 @@ class Results $display_field, isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] - : $GLOBALS['db'] + : $GLOBALS['db'], ]; } } @@ -5964,6 +6014,10 @@ class Results $truncated = false; } - return [$truncated, $str, $original_length]; + return [ + $truncated, + $str, + $original_length, + ]; } } diff --git a/libraries/classes/Encoding.php b/libraries/classes/Encoding.php index 58454c143e..5b8c1358b3 100644 --- a/libraries/classes/Encoding.php +++ b/libraries/classes/Encoding.php @@ -67,10 +67,26 @@ class Encoding * @var array */ private static $_enginemap = [ - 'iconv' => ['iconv', self::ENGINE_ICONV, 'iconv'], - 'recode' => ['recode_string', self::ENGINE_RECODE, 'recode'], - 'mb' => ['mb_convert_encoding', self::ENGINE_MB, 'mbstring'], - 'none' => ['isset', self::ENGINE_NONE, ''], + 'iconv' => [ + 'iconv', + self::ENGINE_ICONV, + 'iconv', + ], + 'recode' => [ + 'recode_string', + self::ENGINE_RECODE, + 'recode', + ], + 'mb' => [ + 'mb_convert_encoding', + self::ENGINE_MB, + 'mbstring', + ], + 'none' => [ + 'isset', + self::ENGINE_NONE, + '', + ], ]; /** @@ -79,7 +95,9 @@ class Encoding * @var array */ private static $_engineorder = [ - 'iconv', 'mb', 'recode', + 'iconv', + 'mb', + 'recode', ]; /** diff --git a/libraries/classes/Error.php b/libraries/classes/Error.php index fb82bb17f6..799ab9c600 100644 --- a/libraries/classes/Error.php +++ b/libraries/classes/Error.php @@ -131,7 +131,12 @@ class Error extends Message { $result = []; - $members = ['line', 'function', 'class', 'type']; + $members = [ + 'line', + 'function', + 'class', + 'type', + ]; foreach ($backtrace as $idx => $step) { /* Create new backtrace entry */ @@ -415,7 +420,7 @@ class Error extends Message 'mysqli_connect', 'mysqli_real_connect', 'connect', - '_realConnect' + '_realConnect', ]; if (in_array($function, $include_functions)) { diff --git a/libraries/classes/ErrorReport.php b/libraries/classes/ErrorReport.php index b93351e359..2e3b2fec80 100644 --- a/libraries/classes/ErrorReport.php +++ b/libraries/classes/ErrorReport.php @@ -203,7 +203,10 @@ class ErrorReport } $uri = $scriptName . "?" . $query; - return [$uri, $scriptName]; + return [ + $uri, + $scriptName, + ]; } /** diff --git a/libraries/classes/Export.php b/libraries/classes/Export.php index 87b6171892..4dc91def5f 100644 --- a/libraries/classes/Export.php +++ b/libraries/classes/Export.php @@ -322,7 +322,10 @@ class Export $filename .= '.zip'; $mime_type = 'application/zip'; } - return [$filename, $mime_type]; + return [ + $filename, + $mime_type, + ]; } /** @@ -375,7 +378,11 @@ class Export ); $message->addParam($save_filename); } - return [$save_filename, $message, $file_handle]; + return [ + $save_filename, + $message, + $file_handle, + ]; } /** @@ -489,7 +496,10 @@ class Export $back_button .= 'db_export.php" data-post="' . Url::getCommon(['db' => $db], ''); } else { $back_button .= 'tbl_export.php" data-post="' . Url::getCommon( - ['db' => $db, 'table' => $table], + [ + 'db' => $db, + 'table' => $table, + ], '' ); } @@ -531,7 +541,11 @@ class Export . '<textarea name="sqldump" cols="50" rows="30" ' . 'id="textSQLDUMP" wrap="OFF">'; - return [$html, $back_button, $refreshButton]; + return [ + $html, + $back_button, + $refreshButton, + ]; } /** diff --git a/libraries/classes/Font.php b/libraries/classes/Font.php index 50394447cd..b1727f2e85 100644 --- a/libraries/classes/Font.php +++ b/libraries/classes/Font.php @@ -28,48 +28,137 @@ class Font $charLists = []; //ijl - $charLists[] = ["chars" => ["i", "j", "l"], "modifier" => 0.23]; + $charLists[] = [ + "chars" => [ + "i", + "j", + "l", + ], "modifier" => 0.23, + ]; //f - $charLists[] = ["chars" => ["f"], "modifier" => 0.27]; + $charLists[] = [ + "chars" => ["f"], + "modifier" => 0.27, + ]; //tI - $charLists[] = ["chars" => ["t", "I"], "modifier" => 0.28]; + $charLists[] = [ + "chars" => [ + "t", + "I", + ], "modifier" => 0.28, + ]; //r - $charLists[] = ["chars" => ["r"], "modifier" => 0.34]; + $charLists[] = [ + "chars" => ["r"], + "modifier" => 0.34, + ]; //1 - $charLists[] = ["chars" => ["1"], "modifier" => 0.49]; + $charLists[] = [ + "chars" => ["1"], + "modifier" => 0.49, + ]; //cksvxyzJ $charLists[] = [ - "chars" => ["c", "k", "s", "v", "x", "y", "z", "J"], - "modifier" => 0.5 + "chars" => [ + "c", + "k", + "s", + "v", + "x", + "y", + "z", + "J", + ], + "modifier" => 0.5, ]; //abdeghnopquL023456789 $charLists[] = [ "chars" => [ - "a", "b", "d", "e", "g", "h", "n", "o", "p", "q", "u", "L", - "0", "2", "3", "4", "5", "6", "7", "8", "9" + "a", + "b", + "d", + "e", + "g", + "h", + "n", + "o", + "p", + "q", + "u", + "L", + "0", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", ], - "modifier" => 0.56 + "modifier" => 0.56, ]; //FTZ - $charLists[] = ["chars" => ["F", "T", "Z"], "modifier" => 0.61]; + $charLists[] = [ + "chars" => [ + "F", + "T", + "Z", + ], "modifier" => 0.61, + ]; //ABEKPSVXY $charLists[] = [ - "chars" => ["A", "B", "E", "K", "P", "S", "V", "X", "Y"], - "modifier" => 0.67 + "chars" => [ + "A", + "B", + "E", + "K", + "P", + "S", + "V", + "X", + "Y", + ], + "modifier" => 0.67, ]; //wCDHNRU $charLists[] = [ - "chars" => ["w", "C", "D", "H", "N", "R", "U"], - "modifier" => 0.73 + "chars" => [ + "w", + "C", + "D", + "H", + "N", + "R", + "U", + ], + "modifier" => 0.73, ]; //GOQ - $charLists[] = ["chars" => ["G", "O", "Q"], "modifier" => 0.78]; + $charLists[] = [ + "chars" => [ + "G", + "O", + "Q", + ], "modifier" => 0.78, + ]; //mM - $charLists[] = ["chars" => ["m", "M"], "modifier" => 0.84]; + $charLists[] = [ + "chars" => [ + "m", + "M", + ], "modifier" => 0.84, + ]; //W - $charLists[] = ["chars" => ["W"], "modifier" => 0.95]; + $charLists[] = [ + "chars" => ["W"], + "modifier" => 0.95, + ]; //" " - $charLists[] = ["chars" => [" "], "modifier" => 0.28]; + $charLists[] = [ + "chars" => [" "], + "modifier" => 0.28, + ]; return $charLists; } diff --git a/libraries/classes/Footer.php b/libraries/classes/Footer.php index 7bb9f36e38..da1caff14a 100644 --- a/libraries/classes/Footer.php +++ b/libraries/classes/Footer.php @@ -151,7 +151,7 @@ class Footer 'db' => $db, 'table' => $table, 'server' => $GLOBALS['server'], - 'target' => $target + 'target' => $target, ]; // needed for server privileges tabs if (isset($_GET['viewing_mode']) diff --git a/libraries/classes/Gis/GisGeometry.php b/libraries/classes/Gis/GisGeometry.php index d7ea40acd1..962aac2083 100644 --- a/libraries/classes/Gis/GisGeometry.php +++ b/libraries/classes/Gis/GisGeometry.php @@ -199,7 +199,10 @@ abstract class GisGeometry $wkt = $value; } - return ['srid' => $srid, 'wkt' => $wkt]; + return [ + 'srid' => $srid, + 'wkt' => $wkt + ]; } /** @@ -241,7 +244,10 @@ abstract class GisGeometry } if (! $linear) { - $points_arr[] = [$x, $y]; + $points_arr[] = [ + $x, + $y, + ]; } else { $points_arr[] = $x; $points_arr[] = $y; diff --git a/libraries/classes/Gis/GisLineString.php b/libraries/classes/Gis/GisLineString.php index e32a4f37f1..cb003f7b82 100644 --- a/libraries/classes/Gis/GisLineString.php +++ b/libraries/classes/Gis/GisLineString.php @@ -151,7 +151,14 @@ class GisLineString extends GisGeometry $red = hexdec(mb_substr($line_color, 1, 2)); $green = hexdec(mb_substr($line_color, 3, 2)); $blue = hexdec(mb_substr($line_color, 4, 2)); - $line = ['width' => 1.5, 'color' => [$red, $green, $blue]]; + $line = [ + 'width' => 1.5, + 'color' => [ + $red, + $green, + $blue, + ], + ]; // Trim to remove leading 'LINESTRING(' and trailing ')' $linesrting diff --git a/libraries/classes/Gis/GisMultiLineString.php b/libraries/classes/Gis/GisMultiLineString.php index 1827a3a5f0..3e7e48f526 100644 --- a/libraries/classes/Gis/GisMultiLineString.php +++ b/libraries/classes/Gis/GisMultiLineString.php @@ -166,7 +166,14 @@ class GisMultiLineString extends GisGeometry $red = hexdec(mb_substr($line_color, 1, 2)); $green = hexdec(mb_substr($line_color, 3, 2)); $blue = hexdec(mb_substr($line_color, 4, 2)); - $line = ['width' => 1.5, 'color' => [$red, $green, $blue]]; + $line = [ + 'width' => 1.5, + 'color' => [ + $red, + $green, + $blue, + ], + ]; // Trim to remove leading 'MULTILINESTRING((' and trailing '))' $multilinestirng diff --git a/libraries/classes/Gis/GisMultiPoint.php b/libraries/classes/Gis/GisMultiPoint.php index fdc979a3c3..2a49b1c52e 100644 --- a/libraries/classes/Gis/GisMultiPoint.php +++ b/libraries/classes/Gis/GisMultiPoint.php @@ -148,7 +148,14 @@ class GisMultiPoint extends GisGeometry $red = hexdec(mb_substr($point_color, 1, 2)); $green = hexdec(mb_substr($point_color, 3, 2)); $blue = hexdec(mb_substr($point_color, 4, 2)); - $line = ['width' => 1.25, 'color' => [$red, $green, $blue]]; + $line = [ + 'width' => 1.25, + 'color' => [ + $red, + $green, + $blue, + ], + ]; // Trim to remove leading 'MULTIPOINT(' and trailing ')' $multipoint diff --git a/libraries/classes/Gis/GisMultiPolygon.php b/libraries/classes/Gis/GisMultiPolygon.php index cfd94c3580..543cfa8ea9 100644 --- a/libraries/classes/Gis/GisMultiPolygon.php +++ b/libraries/classes/Gis/GisMultiPolygon.php @@ -144,7 +144,10 @@ class GisMultiPolygon extends GisGeometry imagefilledpolygon($image, $points_arr, sizeof($points_arr) / 2, $color); // mark label point if applicable if (isset($label) && trim($label) != '' && $first_poly) { - $label_point = [$points_arr[2], $points_arr[3]]; + $label_point = [ + $points_arr[2], + $points_arr[3], + ]; } $first_poly = false; } @@ -181,7 +184,11 @@ class GisMultiPolygon extends GisGeometry $red = hexdec(mb_substr($fill_color, 1, 2)); $green = hexdec(mb_substr($fill_color, 3, 2)); $blue = hexdec(mb_substr($fill_color, 4, 2)); - $color = [$red, $green, $blue]; + $color = [ + $red, + $green, + $blue, + ]; // Trim to remove leading 'MULTIPOLYGON(((' and trailing ')))' $multipolygon @@ -217,7 +224,10 @@ class GisMultiPolygon extends GisGeometry $pdf->Polygon($points_arr, 'F*', [], $color, true); // mark label point if applicable if (isset($label) && trim($label) != '' && $first_poly) { - $label_point = [$points_arr[2], $points_arr[3]]; + $label_point = [ + $points_arr[2], + $points_arr[3], + ]; } $first_poly = false; } diff --git a/libraries/classes/Gis/GisPoint.php b/libraries/classes/Gis/GisPoint.php index 1c73632a6c..940f5b5bfc 100644 --- a/libraries/classes/Gis/GisPoint.php +++ b/libraries/classes/Gis/GisPoint.php @@ -153,7 +153,14 @@ class GisPoint extends GisGeometry $red = hexdec(mb_substr($point_color, 1, 2)); $green = hexdec(mb_substr($point_color, 3, 2)); $blue = hexdec(mb_substr($point_color, 4, 2)); - $line = ['width' => 1.25, 'color' => [$red, $green, $blue]]; + $line = [ + 'width' => 1.25, + 'color' => [ + $red, + $green, + $blue, + ], + ]; // Trim to remove leading 'POINT(' and trailing ')' $point diff --git a/libraries/classes/Gis/GisPolygon.php b/libraries/classes/Gis/GisPolygon.php index dc97f4562b..494cd5592c 100644 --- a/libraries/classes/Gis/GisPolygon.php +++ b/libraries/classes/Gis/GisPolygon.php @@ -162,7 +162,11 @@ class GisPolygon extends GisGeometry $red = hexdec(mb_substr($fill_color, 1, 2)); $green = hexdec(mb_substr($fill_color, 3, 2)); $blue = hexdec(mb_substr($fill_color, 4, 2)); - $color = [$red, $green, $blue]; + $color = [ + $red, + $green, + $blue, + ]; // Trim to remove leading 'POLYGON((' and trailing '))' $polygon = mb_substr( diff --git a/libraries/classes/Import.php b/libraries/classes/Import.php index 8239d021a1..e10e6e8a5e 100644 --- a/libraries/classes/Import.php +++ b/libraries/classes/Import.php @@ -111,7 +111,7 @@ class Import } $my_die[] = [ 'sql' => $full, - 'error' => $GLOBALS['dbi']->getError() + 'error' => $GLOBALS['dbi']->getError(), ]; $msg .= __('Error'); @@ -317,7 +317,10 @@ class Import string $full ): ?array { if (! empty($sql) || ! empty($full)) { - $import_run_buffer = ['sql' => $sql, 'full' => $full]; + $import_run_buffer = [ + 'sql' => $sql, + 'full' => $full, + ]; return $import_run_buffer; } @@ -348,7 +351,10 @@ class Import $reload = true; } - return [$db, $reload]; + return [ + $db, + $reload, + ]; } @@ -581,7 +587,11 @@ class Import $m = $curr_size - 1; $d = $decPrecision; - return [$m, $d, ($m . "," . $d)]; + return [ + $m, + $d, + ($m . "," . $d), + ]; } /** @@ -929,7 +939,10 @@ class Import } } - return [$types, $sizes]; + return [ + $types, + $sizes, + ]; } /** @@ -1043,7 +1056,7 @@ class Import self::INT => "int", self::DECIMAL => "decimal", self::BIGINT => "bigint", - self::GEOMETRY => 'geometry' + self::GEOMETRY => 'geometry', ]; /* TODO: Do more checking here to make sure they really are matched */ @@ -1262,7 +1275,7 @@ class Import for ($i = 0; $i < $num_tables; ++$i) { $params = [ 'db' => (string) $db_name, - 'table' => (string) $tables[$i][self::TBL_NAME] + 'table' => (string) $tables[$i][self::TBL_NAME], ]; $tbl_url = 'sql.php' . Url::getCommon($params); $tbl_struct_url = 'tbl_structure.php' . Url::getCommon($params); @@ -1444,14 +1457,14 @@ class Import // URL to matched rows. $_url_params = [ 'db' => $GLOBALS['db'], - 'sql_query' => $matched_row_query + 'sql_query' => $matched_row_query, ]; $matched_rows_url = 'sql.php' . Url::getCommon($_url_params); return [ 'sql_query' => Util::formatSql($analyzed_sql_results['query']), 'matched_rows' => $matched_rows, - 'matched_rows_url' => $matched_rows_url + 'matched_rows_url' => $matched_rows_url, ]; } @@ -1700,7 +1713,7 @@ class Import 'TOKUDB', 'XTRADB', 'SEQUENCE', - 'BDB' + 'BDB', ]; // Query to check if table is 'Transactional'. diff --git a/libraries/classes/Index.php b/libraries/classes/Index.php index d27c66c256..cf74d0e9b6 100644 --- a/libraries/classes/Index.php +++ b/libraries/classes/Index.php @@ -488,7 +488,7 @@ class Index { return [ 'BTREE', - 'HASH' + 'HASH', ]; } diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 396da80e83..1411ded71e 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -157,7 +157,12 @@ class InsertEdit $found_unique_key = true; } } - return [$where_clauses, $result, $rows, $found_unique_key]; + return [ + $where_clauses, + $result, + $rows, + $found_unique_key, + ]; } /** @@ -232,7 +237,10 @@ class InsertEdit DatabaseInterface::QUERY_STORE ); $rows = array_fill(0, $GLOBALS['cfg']['InsertRows'], false); - return [$result, $rows]; + return [ + $result, + $rows, + ]; } /** @@ -343,15 +351,26 @@ class InsertEdit $column['Field_title'] = $this->getColumnTitle($column, $comments_map); $column['is_binary'] = $this->isColumn( $column, - ['binary', 'varbinary'] + [ + 'binary', + 'varbinary', + ] ); $column['is_blob'] = $this->isColumn( $column, - ['blob', 'tinyblob', 'mediumblob', 'longblob'] + [ + 'blob', + 'tinyblob', + 'mediumblob', + 'longblob', + ] ); $column['is_char'] = $this->isColumn( $column, - ['char', 'varchar'] + [ + 'char', + 'varchar', + ] ); list($column['pma_type'], $column['wrap'], $column['first_timestamp']) @@ -432,7 +451,11 @@ class InsertEdit $column['wrap'] = ' nowrap'; break; } - return [$column['pma_type'], $column['wrap'], $column['first_timestamp']]; + return [ + $column['pma_type'], + $column['wrap'], + $column['first_timestamp'], + ]; } /** @@ -867,7 +890,7 @@ class InsertEdit 'table' => $table, 'field' => $column['Field'], 'rownumber' => $rownumber, - 'data' => $data + 'data' => $data, ], '' ) . '">' @@ -1300,7 +1323,10 @@ class InsertEdit } $column['select_size'] = min(4, count($column['values'])); } - return [$column['values'], $column['select_size']]; + return [ + $column['values'], + $column['select_size'], + ]; } /** @@ -1549,7 +1575,7 @@ class InsertEdit 'tinyblob' => '256', 'blob' => '65536', 'mediumblob' => '16777216', - 'longblob' => '4294967296' // yeah, really + 'longblob' => '4294967296',// yeah, really ]; $this_field_max_size = $max_upload_size; // from PHP max @@ -1565,7 +1591,10 @@ class InsertEdit if ($this_field_max_size > $biggest_max_file_size) { $biggest_max_file_size = $this_field_max_size; } - return [$html_output, $biggest_max_file_size]; + return [ + $html_output, + $biggest_max_file_size, + ]; } /** @@ -1647,7 +1676,10 @@ class InsertEdit ); $virtual = [ - 'VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED' + 'VIRTUAL', + 'PERSISTENT', + 'VIRTUAL GENERATED', + 'STORED GENERATED', ]; if (in_array($column['Extra'], $virtual)) { $html_output .= '<input type="hidden" name="virtual' @@ -2053,7 +2085,7 @@ class InsertEdit $special_chars_encoded, $special_chars, $data, - $backup_field + $backup_field, ]; } @@ -2099,8 +2131,11 @@ class InsertEdit $special_chars ); return [ - $real_null_value, $data, $special_chars, - $backup_field, $special_chars_encoded + $real_null_value, + $data, + $special_chars, + $backup_field, + $special_chars_encoded, ]; } @@ -2134,7 +2169,12 @@ class InsertEdit } $is_insertignore = isset($_POST['submit_type']) && $_POST['submit_type'] == 'insertignore'; - return [$loop_array, $using_key, $is_insert, $is_insertignore]; + return [ + $loop_array, + $using_key, + $is_insert, + $is_insertignore, + ]; } /** @@ -2208,7 +2248,11 @@ class InsertEdit */ public function getGotoInclude($goto_include) { - $valid_options = ['new_insert', 'same_insert', 'edit_next']; + $valid_options = [ + 'new_insert', + 'same_insert', + 'edit_next', + ]; if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $valid_options) ) { @@ -2344,7 +2388,7 @@ class InsertEdit $last_messages, $warning_messages, $error_messages, - $return_to_sql_query + $return_to_sql_query, ]; } @@ -2446,7 +2490,7 @@ class InsertEdit . Util::backquote($foreigner['foreign_db']) . '.' . Util::backquote($foreigner['foreign_table']) . ' WHERE ' . Util::backquote($foreigner['foreign_field']) - . $where_comparison + . $where_comparison, ]; $output = '<a href="sql.php' . Url::getCommon($_url_params) . '"' . $title . '>'; @@ -2494,7 +2538,7 @@ class InsertEdit 'db' => $db, 'table' => $table, 'where_clause' => $_POST['where_clause'], - 'transform_key' => $column_name + 'transform_key' => $column_name, ]; $transform_options = $this->transformations->getOptions( isset($transformation[$type . '_options']) @@ -2657,7 +2701,10 @@ class InsertEdit . ' = ' . $current_value_as_an_array; } } - return [$query_values, $query_fields]; + return [ + $query_values, + $query_fields, + ]; } /** @@ -2909,9 +2956,14 @@ class InsertEdit } return [ - $insert_mode, $where_clause, $where_clause_array, $where_clauses, - $result, $rows, $found_unique_key, - isset($after_insert) ? $after_insert : null + $insert_mode, + $where_clause, + $where_clause_array, + $where_clauses, + $result, + $rows, + $found_unique_key, + isset($after_insert) ? $after_insert : null, ]; } @@ -2949,7 +3001,7 @@ class InsertEdit */ $url_params = [ 'db' => $db, - 'sql_query' => $_POST['sql_query'] + 'sql_query' => $_POST['sql_query'], ]; if (preg_match('@^tbl_@', $GLOBALS['goto'])) { @@ -3290,7 +3342,7 @@ class InsertEdit 'db' => $db, 'table' => $table, 'transform_key' => $column['Field'], - 'where_clause' => $where_clause + 'where_clause' => $where_clause, ]; $transformation_options['wrapper_link'] = Url::getCommon($_url_params); @@ -3334,7 +3386,10 @@ class InsertEdit $data, $special_chars, $foreignData, - [$table, $db], + [ + $table, + $db, + ], $row_id, $titles, $text_dir, diff --git a/libraries/classes/IpAllowDeny.php b/libraries/classes/IpAllowDeny.php index b1052e8441..6e441854b6 100644 --- a/libraries/classes/IpAllowDeny.php +++ b/libraries/classes/IpAllowDeny.php @@ -285,7 +285,7 @@ class IpAllowDeny // lookup table for some name shortcuts $shortcuts = [ 'all' => '0.0.0.0/0', - 'localhost' => '127.0.0.1/8' + 'localhost' => '127.0.0.1/8', ]; // Provide some useful shortcuts if server gives us address: diff --git a/libraries/classes/Linter.php b/libraries/classes/Linter.php index 90fa614657..7738cee168 100644 --- a/libraries/classes/Linter.php +++ b/libraries/classes/Linter.php @@ -80,7 +80,10 @@ class Linter } $line = $lineNo; } - return [$line, $pos - $lines[$line]]; + return [ + $line, + $pos - $lines[$line], + ]; } /** @@ -105,7 +108,7 @@ class Linter 'toLine' => 0, 'toColumn' => 0, 'severity' => 'warning', - ] + ], ]; } diff --git a/libraries/classes/Menu.php b/libraries/classes/Menu.php index f689b0ee3c..433b1a6919 100644 --- a/libraries/classes/Menu.php +++ b/libraries/classes/Menu.php @@ -269,7 +269,8 @@ class Menu ), Url::getCommon( [ - 'db' => $this->_db, 'table' => $this->_table + 'db' => $this->_db, + 'table' => $this->_table, ] ), str_replace(' ', ' ', htmlspecialchars($this->_table)), @@ -356,7 +357,10 @@ class Menu $tabs['structure']['text'] = __('Structure'); $tabs['structure']['active'] = in_array( basename($GLOBALS['PMA_PHP_SELF']), - ['tbl_structure.php', 'tbl_relation.php'] + [ + 'tbl_structure.php', + 'tbl_relation.php', + ] ); $tabs['sql']['icon'] = 'b_sql'; @@ -368,7 +372,11 @@ class Menu $tabs['search']['link'] = 'tbl_select.php'; $tabs['search']['active'] = in_array( basename($GLOBALS['PMA_PHP_SELF']), - ['tbl_select.php', 'tbl_zoom_select.php', 'tbl_find_replace.php'] + [ + 'tbl_select.php', + 'tbl_zoom_select.php', + 'tbl_find_replace.php', + ] ); if (! $db_is_system_schema && (! $tbl_is_view || $updatable_view)) { @@ -597,7 +605,7 @@ class Menu 'server_status_monitor.php', 'server_status_queries.php', 'server_status_variables.php', - 'server_status_processes.php' + 'server_status_processes.php', ] ); @@ -607,7 +615,10 @@ class Menu $tabs['rights']['text'] = __('User accounts'); $tabs['rights']['active'] = in_array( basename($GLOBALS['PMA_PHP_SELF']), - ['server_privileges.php', 'server_user_groups.php'] + [ + 'server_privileges.php', + 'server_user_groups.php', + ] ); $tabs['rights']['args']['viewing_mode'] = 'server'; } @@ -625,7 +636,10 @@ class Menu $tabs['settings']['text'] = __('Settings'); $tabs['settings']['active'] = in_array( basename($GLOBALS['PMA_PHP_SELF']), - ['prefs_forms.php', 'prefs_manage.php'] + [ + 'prefs_forms.php', + 'prefs_manage.php', + ] ); if (! empty($binary_logs)) { diff --git a/libraries/classes/MultSubmits.php b/libraries/classes/MultSubmits.php index eb80298f41..cb3b429076 100644 --- a/libraries/classes/MultSubmits.php +++ b/libraries/classes/MultSubmits.php @@ -384,7 +384,7 @@ class MultSubmits $runParts, $executeQueryLater, $sqlQuery, - $sqlQueryViews + $sqlQueryViews, ]; } @@ -642,6 +642,10 @@ class MultSubmits $fullQueryViews = isset($fullQueryViews) ? $fullQueryViews : null; - return [$fullQuery, $reload, $fullQueryViews]; + return [ + $fullQuery, + $reload, + $fullQueryViews, + ]; } } diff --git a/libraries/classes/Navigation/NavigationTree.php b/libraries/classes/Navigation/NavigationTree.php index 27b9292b68..d2cddc15be 100644 --- a/libraries/classes/Navigation/NavigationTree.php +++ b/libraries/classes/Navigation/NavigationTree.php @@ -863,7 +863,10 @@ class NavigationTree $children = $this->_tree->children; usort( $children, - ['PhpMyAdmin\\Navigation\\NavigationTree', 'sortNode'] + [ + 'PhpMyAdmin\\Navigation\\NavigationTree', + 'sortNode', + ] ); $this->_setVisibility(); for ($i = 0, $nbChildren = count($children); $i < $nbChildren; $i++) { @@ -906,7 +909,10 @@ class NavigationTree $children = $node->children; usort( $children, - ['PhpMyAdmin\\Navigation\\NavigationTree', 'sortNode'] + [ + 'PhpMyAdmin\\Navigation\\NavigationTree', + 'sortNode', + ] ); for ($i = 0, $nbChildren = count($children); $i < $nbChildren; $i++) { if ($i + 1 != $nbChildren) { @@ -1210,7 +1216,10 @@ class NavigationTree $children = $node->children; usort( $children, - ['PhpMyAdmin\\Navigation\\NavigationTree', 'sortNode'] + [ + 'PhpMyAdmin\\Navigation\\NavigationTree', + 'sortNode', + ] ); $buffer = ''; $extra_class = ''; @@ -1302,7 +1311,10 @@ class NavigationTree $children = $this->_tree->children; usort( $children, - ['PhpMyAdmin\\Navigation\\NavigationTree', 'sortNode'] + [ + 'PhpMyAdmin\\Navigation\\NavigationTree', + 'sortNode', + ] ); $this->_setVisibility(); for ($i = 0, $nbChildren = count($children); $i < $nbChildren; $i++) { diff --git a/libraries/classes/Normalization.php b/libraries/classes/Normalization.php index 440c31abe1..2c4b016518 100644 --- a/libraries/classes/Normalization.php +++ b/libraries/classes/Normalization.php @@ -355,7 +355,7 @@ class Normalization 'headText' => $headText, 'subText' => $subText, 'extra' => $extra, - 'primary_key' => json_encode($pk) + 'primary_key' => json_encode($pk), ]; } @@ -450,7 +450,7 @@ class Normalization 'headText' => $headText, 'subText' => $subText, 'extra' => $extra, - 'primary_key' => $key + 'primary_key' => $key, ]; } @@ -508,8 +508,9 @@ class Normalization ) . '</h3>'; if (count((array) $partialDependencies) == 1) { return [ - 'legendText' => __('End of step'), 'headText' => $headText, - 'queryError' => $error + 'legendText' => __('End of step'), + 'headText' => $headText, + 'queryError' => $error, ]; } $message = ''; @@ -613,14 +614,19 @@ class Normalization . (count($dependents) > 0 ? ', ' : '') . htmlspecialchars(implode(', ', $dependents)) . ' )'; $newTables[$table][$tableName] = [ - "pk" => $key, "nonpk" => implode(', ', $dependents) + "pk" => $key, + "nonpk" => implode(', ', $dependents), ]; $i++; $tableName = 'table' . $i; } } } - return ['html' => $html, 'newTables' => $newTables, 'success' => true]; + return [ + 'html' => $html, + 'newTables' => $newTables, + 'success' => true + ]; } /** @@ -641,8 +647,9 @@ class Normalization . '</h3>'; if (count((array) $newTables) == 0) { return [ - 'legendText' => __('End of step'), 'headText' => $headText, - 'queryError' => $error + 'legendText' => __('End of step'), + 'headText' => $headText, + 'queryError' => $error, ]; } $message = ''; @@ -761,7 +768,10 @@ class Normalization $query2 .= ' DROP ' . $repeatingColumn . ','; } $query2 = trim($query2, ','); - $queries = [$query1, $query2]; + $queries = [ + $query1, + $query2, + ]; $this->dbi->selectDb($db); foreach ($queries as $query) { if (! $this->dbi->tryQuery($query)) { @@ -777,7 +787,8 @@ class Normalization } } return [ - 'queryError' => $error, 'message' => $message + 'queryError' => $error, + 'message' => $message ]; } diff --git a/libraries/classes/OpenDocument.php b/libraries/classes/OpenDocument.php index 79e036c59c..40ebe154d1 100644 --- a/libraries/classes/OpenDocument.php +++ b/libraries/classes/OpenDocument.php @@ -162,7 +162,7 @@ EOT; . ' manifest:full-path="meta.xml"/>' . '<manifest:file-entry manifest:media-type="text/xml"' . ' manifest:full-path="styles.xml"/>' - . '</manifest:manifest>' + . '</manifest:manifest>', ]; $name = [ @@ -170,7 +170,7 @@ EOT; 'content.xml', 'meta.xml', 'styles.xml', - 'META-INF/manifest.xml' + 'META-INF/manifest.xml', ]; $zipExtension = new ZipExtension(); diff --git a/libraries/classes/Operations.php b/libraries/classes/Operations.php index 6305b3e3ea..bc26b872bd 100644 --- a/libraries/classes/Operations.php +++ b/libraries/classes/Operations.php @@ -197,7 +197,7 @@ class Operations $choices = [ 'structure' => __('Structure only'), 'data' => __('Structure and data'), - 'dataonly' => __('Data only') + 'dataonly' => __('Data only'), ]; $pma_switch_to_new = isset($_SESSION['pma_switch_to_new']) && $_SESSION['pma_switch_to_new']; @@ -795,7 +795,11 @@ class Operations public function duplicateBookmarks($_error, $db) { if (! $_error && $db != $_POST['newname']) { - $get_fields = ['user', 'label', 'query']; + $get_fields = [ + 'user', + 'label', + 'query', + ]; $where_fields = ['dbase' => $db]; $new_fields = ['dbase' => $_POST['newname']]; Table::duplicateInfo( @@ -1274,7 +1278,7 @@ class Operations ], 'INNODB' => [ 'COMPACT' => 'COMPACT', - 'REDUNDANT' => 'REDUNDANT' + 'REDUNDANT' => 'REDUNDANT', ] ]; @@ -1333,7 +1337,7 @@ class Operations $choices = [ 'structure' => __('Structure only'), 'data' => __('Structure and data'), - 'dataonly' => __('Data only') + 'dataonly' => __('Data only'), ]; $html_output .= Util::getRadioFields( @@ -1484,7 +1488,7 @@ class Operations $params = [ 'sql_query' => 'ALTER TABLE ' . Util::backquote($GLOBALS['table']) - . ' ENGINE = InnoDB;' + . ' ENGINE = InnoDB;', ]; $html_output .= $this->getMaintainActionlink( __('Defragment table'), @@ -1620,7 +1624,10 @@ class Operations return '<li>' . Util::linkOrButton( 'sql.php' . Url::getCommon($url_params), $link, - ['id' => $htmlId, 'class' => 'ajax'] + [ + 'id' => $htmlId, + 'class' => 'ajax', + ] ) . Util::showMySQLDocu($syntax) . '</li>'; @@ -1642,7 +1649,7 @@ class Operations 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair'), - 'TRUNCATE' => __('Truncate') + 'TRUNCATE' => __('Truncate'), ]; $partition_method = Partition::getPartitionMethod( @@ -1699,7 +1706,7 @@ class Operations [ 'sql_query' => 'ALTER TABLE ' . Util::backquote($GLOBALS['table']) - . ' REMOVE PARTITIONING;' + . ' REMOVE PARTITIONING;', ] ); $html_output .= '<div class="clearfloat"><br>'; @@ -1806,7 +1813,10 @@ class Operations $sql_query .= ';'; $result = $this->dbi->query($sql_query); - return [$sql_query, $result]; + return [ + $sql_query, + $result, + ]; } /** @@ -1968,7 +1978,10 @@ class Operations $result = $this->dbi->query($sql_query); - return [$sql_query, $result]; + return [ + $sql_query, + $result, + ]; } /** diff --git a/libraries/classes/OutputBuffering.php b/libraries/classes/OutputBuffering.php index 712e7e6208..cd44e6afca 100644 --- a/libraries/classes/OutputBuffering.php +++ b/libraries/classes/OutputBuffering.php @@ -90,7 +90,10 @@ class OutputBuffering header('X-ob_mode: ' . $this->_mode); } register_shutdown_function( - [OutputBuffering::class, 'stop'] + [ + OutputBuffering::class, + 'stop', + ] ); $this->_on = true; } diff --git a/libraries/classes/ParseAnalyze.php b/libraries/classes/ParseAnalyze.php index 9166854b5d..8fa8ff2e0b 100644 --- a/libraries/classes/ParseAnalyze.php +++ b/libraries/classes/ParseAnalyze.php @@ -75,6 +75,10 @@ class ParseAnalyze $analyzed_sql_results['reload'] = $reload; } - return [$analyzed_sql_results, $db, $table]; + return [ + $analyzed_sql_results, + $db, + $table, + ]; } } diff --git a/libraries/classes/Plugins/Auth/AuthenticationCookie.php b/libraries/classes/Plugins/Auth/AuthenticationCookie.php index 0a18257ba6..38c7c161fe 100644 --- a/libraries/classes/Plugins/Auth/AuthenticationCookie.php +++ b/libraries/classes/Plugins/Auth/AuthenticationCookie.php @@ -134,13 +134,13 @@ class AuthenticationCookie extends AuthenticationPlugin echo $this->template->render('login/header', [ 'theme' => $GLOBALS['PMA_Theme'], 'add_class' => ' modal_form', - 'session_expired' => 1 + 'session_expired' => 1, ]); } else { echo $this->template->render('login/header', [ 'theme' => $GLOBALS['PMA_Theme'], 'add_class' => '', - 'session_expired' => 0 + 'session_expired' => 0, ]); } diff --git a/libraries/classes/Plugins/Export/ExportJson.php b/libraries/classes/Plugins/Export/ExportJson.php index 27f80d7fdb..b7befa7a79 100644 --- a/libraries/classes/Plugins/Export/ExportJson.php +++ b/libraries/classes/Plugins/Export/ExportJson.php @@ -157,7 +157,7 @@ class ExportJson extends ExportPlugin $meta = [ 'type' => 'database', - 'name' => $db_alias + 'name' => $db_alias, ]; return $this->export->outputHandler( diff --git a/libraries/classes/Plugins/Export/ExportLatex.php b/libraries/classes/Plugins/Export/ExportLatex.php index 9ac47af4d6..9d796209f1 100644 --- a/libraries/classes/Plugins/Export/ExportLatex.php +++ b/libraries/classes/Plugins/Export/ExportLatex.php @@ -346,13 +346,19 @@ class ExportLatex extends ExportPlugin 'texEscape', get_class($this), ], - ['table' => $table_alias, 'database' => $db_alias] + [ + 'table' => $table_alias, + 'database' => $db_alias, + ] ) . '} \\label{' . Util::expandUserString( $GLOBALS['latex_data_label'], null, - ['table' => $table_alias, 'database' => $db_alias] + [ + 'table' => $table_alias, + 'database' => $db_alias, + ] ) . '} \\\\'; } @@ -381,7 +387,10 @@ class ExportLatex extends ExportPlugin 'texEscape', get_class($this), ], - ['table' => $table_alias, 'database' => $db_alias] + [ + 'table' => $table_alias, + 'database' => $db_alias, + ] ) . '} \\\\ ' ) @@ -553,13 +562,19 @@ class ExportLatex extends ExportPlugin 'texEscape', get_class($this), ], - ['table' => $table_alias, 'database' => $db_alias] + [ + 'table' => $table_alias, + 'database' => $db_alias, + ] ) . '} \\label{' . Util::expandUserString( $GLOBALS['latex_structure_label'], null, - ['table' => $table_alias, 'database' => $db_alias] + [ + 'table' => $table_alias, + 'database' => $db_alias, + ] ) . '} \\\\' . $crlf; } @@ -574,7 +589,10 @@ class ExportLatex extends ExportPlugin 'texEscape', get_class($this), ], - ['table' => $table_alias, 'database' => $db_alias] + [ + 'table' => $table_alias, + 'database' => $db_alias, + ] ) . '} \\\\ ' . $crlf; } @@ -672,7 +690,16 @@ class ExportLatex extends ExportPlugin */ public static function texEscape($string) { - $escape = ['$', '%', '{', '}', '&', '#', '_', '^']; + $escape = [ + '$', + '%', + '{', + '}', + '&', + '#', + '_', + '^', + ]; $cnt_escape = count($escape); for ($k = 0; $k < $cnt_escape; $k++) { $string = str_replace($escape[$k], '\\' . $escape[$k], $string); diff --git a/libraries/classes/Plugins/Export/ExportPdf.php b/libraries/classes/Plugins/Export/ExportPdf.php index d4accbb944..a36277368b 100644 --- a/libraries/classes/Plugins/Export/ExportPdf.php +++ b/libraries/classes/Plugins/Export/ExportPdf.php @@ -140,7 +140,10 @@ class ExportPdf extends ExportPlugin $pdf = $this->_getPdf(); $pdf->Open(); - $attr = ['titleFontSize' => 18, 'titleText' => $pdf_report_title]; + $attr = [ + 'titleFontSize' => 18, + 'titleText' => $pdf_report_title + ]; $pdf->setAttributes($attr); $pdf->setTopMargin(30); @@ -229,7 +232,7 @@ class ExportPdf extends ExportPlugin 'dbAlias' => $db_alias, 'tableAlias' => $table_alias, 'aliases' => $aliases, - 'purpose' => __('Dumping data') + 'purpose' => __('Dumping data'), ]; $pdf->setAttributes($attr); $pdf->mysqlReport($sql_query); diff --git a/libraries/classes/Plugins/Export/ExportSql.php b/libraries/classes/Plugins/Export/ExportSql.php index 572825f0fa..0acf48f881 100644 --- a/libraries/classes/Plugins/Export/ExportSql.php +++ b/libraries/classes/Plugins/Export/ExportSql.php @@ -384,7 +384,7 @@ class ExportSql extends ExportPlugin $leaf->setDoc( [ 'manual_MySQL_Database_Administration', - 'insert_delayed' + 'insert_delayed', ] ); $subgroup->addProperty($leaf); @@ -2769,8 +2769,7 @@ class ExportSql extends ExportPlugin // Column name. if (! empty($field->type)) { if (! empty($aliases[$old_database]['tables'][$old_table]['columns'][$field->name])) { - $field->name = $aliases[$old_database]['tables'] - [$old_table]['columns'][$field->name]; + $field->name = $aliases[$old_database]['tables'][$old_table]['columns'][$field->name]; $flag = true; } } @@ -2779,8 +2778,7 @@ class ExportSql extends ExportPlugin if (! empty($field->key)) { foreach ($field->key->columns as $key => $column) { if (! empty($aliases[$old_database]['tables'][$old_table]['columns'][$column['name']])) { - $field->key->columns[$key]['name'] = $aliases[$old_database] - ['tables'][$old_table]['columns'][$column['name']]; + $field->key->columns[$key]['name'] = $aliases[$old_database]['tables'][$old_table]['columns'][$column['name']]; $flag = true; } } diff --git a/libraries/classes/Plugins/Export/ExportYaml.php b/libraries/classes/Plugins/Export/ExportYaml.php index 1935c563a7..9b9da93eb9 100644 --- a/libraries/classes/Plugins/Export/ExportYaml.php +++ b/libraries/classes/Plugins/Export/ExportYaml.php @@ -202,8 +202,18 @@ class ExportYaml extends ExportPlugin } $record[$i] = str_replace( - ['\\', '"', "\n", "\r"], - ['\\\\', '\"', '\n', '\r'], + [ + '\\', + '"', + "\n", + "\r", + ], + [ + '\\\\', + '\"', + '\n', + '\r', + ], $record[$i] ); $buffer .= ' ' . $columns[$i] . ': "' . $record[$i] . '"' . $crlf; diff --git a/libraries/classes/Plugins/Export/Helpers/Pdf.php b/libraries/classes/Plugins/Export/Helpers/Pdf.php index 30a626871b..0601d2271c 100644 --- a/libraries/classes/Plugins/Export/Helpers/Pdf.php +++ b/libraries/classes/Plugins/Export/Helpers/Pdf.php @@ -631,29 +631,29 @@ class Pdf extends PdfLib $column['Default'] = 'NULL'; } } - $data [] = $column['Field']; - $data [] = $type; - $data [] = $column['Null'] == '' || $column['Null'] == 'NO' + $data[] = $column['Field']; + $data[] = $type; + $data[] = $column['Null'] == '' || $column['Null'] == 'NO' ? 'No' : 'Yes'; - $data [] = isset($column['Default']) ? $column['Default'] : ''; + $data[] = isset($column['Default']) ? $column['Default'] : ''; $field_name = $column['Field']; if ($do_relation && $have_rel) { - $data [] = isset($res_rel[$field_name]) + $data[] = isset($res_rel[$field_name]) ? $res_rel[$field_name]['foreign_table'] . ' (' . $res_rel[$field_name]['foreign_field'] . ')' : ''; } if ($do_comments) { - $data [] = isset($comments[$field_name]) + $data[] = isset($comments[$field_name]) ? $comments[$field_name] : ''; } if ($do_mime) { - $data [] = isset($mime_map[$field_name]) + $data[] = isset($mime_map[$field_name]) ? $mime_map[$field_name]['mimetype'] : ''; } diff --git a/libraries/classes/Plugins/Import/ImportCsv.php b/libraries/classes/Plugins/Import/ImportCsv.php index 83927f3348..3a21aeebac 100644 --- a/libraries/classes/Plugins/Import/ImportCsv.php +++ b/libraries/classes/Plugins/Import/ImportCsv.php @@ -684,7 +684,11 @@ class ImportCsv extends AbstractImportCsv $tbl_name = 'TBL_NAME'; } - $tables[] = [$tbl_name, $col_names, $rows]; + $tables[] = [ + $tbl_name, + $col_names, + $rows, + ]; /* Obtain the best-fit MySQL types for each column */ $analyses = []; diff --git a/libraries/classes/Plugins/Import/ImportMediawiki.php b/libraries/classes/Plugins/Import/ImportMediawiki.php index 698d44f010..10b28be5c1 100644 --- a/libraries/classes/Plugins/Import/ImportMediawiki.php +++ b/libraries/classes/Plugins/Import/ImportMediawiki.php @@ -219,7 +219,7 @@ class ImportMediawiki extends ImportPlugin $cur_temp_table_headers = $cur_temp_line; } else { // Normal line, add it to the table - $cur_temp_table [] = $cur_temp_line; + $cur_temp_table[] = $cur_temp_line; } } @@ -261,13 +261,16 @@ class ImportMediawiki extends ImportPlugin // Delete the beginning of the column, if there is one $cell = trim($cell); - $col_start_chars = ["|", "!"]; + $col_start_chars = [ + "|", + "!", + ]; foreach ($col_start_chars as $col_start_char) { $cell = $this->_getCellContent($cell, $col_start_char); } // Add the cell to the row - $cur_temp_line [] = $cell; + $cur_temp_line[] = $cell; } // foreach $cells } else { // If it's none of the above, then the current line has a bad @@ -310,11 +313,15 @@ class ImportMediawiki extends ImportPlugin // Create the tables array to be used in Import::buildSql() $tables = []; - $tables [] = [$table[0], $table[1], $table[2]]; + $tables[] = [ + $table[0], + $table[1], + $table[2], + ]; // Obtain the best-fit MySQL types for each column $analyses = []; - $analyses [] = $this->import->analyzeTable($tables[0]); + $analyses[] = $this->import->analyzeTable($tables[0]); $this->_executeImportTables($tables, $analyses, $sql_data); } @@ -355,7 +362,7 @@ class ImportMediawiki extends ImportPlugin // If they are not set, generic names will be given (COL 1, COL 2, etc) $num_cols = count($table_row); for ($i = 0; $i < $num_cols; ++$i) { - $table_headers [$i] = 'COL ' . ($i + 1); + $table_headers[$i] = 'COL ' . ($i + 1); } } } diff --git a/libraries/classes/Plugins/Import/ImportOds.php b/libraries/classes/Plugins/Import/ImportOds.php index 8d72d2d972..39734ba398 100644 --- a/libraries/classes/Plugins/Import/ImportOds.php +++ b/libraries/classes/Plugins/Import/ImportOds.php @@ -312,7 +312,11 @@ class ImportOds extends ImportPlugin $tables[] = [(string) $tbl_attr['name']]; /* Store the current sheet in the accumulator */ - $rows[] = [(string) $tbl_attr['name'], $col_names, $tempRows]; + $rows[] = [ + (string) $tbl_attr['name'], + $col_names, + $tempRows, + ]; $tempRows = []; $col_names = []; $max_cols = 0; diff --git a/libraries/classes/Plugins/Import/ImportShp.php b/libraries/classes/Plugins/Import/ImportShp.php index 4c0ec76d4b..ae0d2c7fff 100644 --- a/libraries/classes/Plugins/Import/ImportShp.php +++ b/libraries/classes/Plugins/Import/ImportShp.php @@ -260,7 +260,13 @@ class ImportShp extends ImportPlugin } else { $table_name = 'TBL_NAME'; } - $tables = [[$table_name, $col_names, $rows]]; + $tables = [ + [ + $table_name, + $col_names, + $rows, + ], + ]; // Use data from shape file to chose best-fit MySQL types for each column $analyses = []; diff --git a/libraries/classes/Plugins/Import/ImportXml.php b/libraries/classes/Plugins/Import/ImportXml.php index fce5b7eced..f2860efd6d 100644 --- a/libraries/classes/Plugins/Import/ImportXml.php +++ b/libraries/classes/Plugins/Import/ImportXml.php @@ -268,7 +268,11 @@ class ImportXml extends ImportPlugin $tempCells[] = (string) $v2; } - $rows[] = [(string) $tbl_attr['name'], $tempRow, $tempCells]; + $rows[] = [ + (string) $tbl_attr['name'], + $tempRow, + $tempCells, + ]; $tempRow = []; $tempCells = []; diff --git a/libraries/classes/Plugins/ImportPlugin.php b/libraries/classes/Plugins/ImportPlugin.php index 7fd015816f..a5df087a05 100644 --- a/libraries/classes/Plugins/ImportPlugin.php +++ b/libraries/classes/Plugins/ImportPlugin.php @@ -86,6 +86,9 @@ abstract class ImportPlugin $options = null; } - return [$db_name, $options]; + return [ + $db_name, + $options, + ]; } } diff --git a/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php b/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php index c00fd34e41..bd445326b8 100644 --- a/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php +++ b/libraries/classes/Plugins/Schema/Dia/RelationStatsDia.php @@ -88,9 +88,17 @@ class RelationStatsDia // left, right, position $value = 12; if ($pos != 0) { - return [$pos + $value + $pos, $pos + $value + $pos + 1, $pos]; + return [ + $pos + $value + $pos, + $pos + $value + $pos + 1, + $pos, + ]; } - return [$pos + $value , $pos + $value + 1, $pos]; + return [ + $pos + $value, + $pos + $value + 1, + $pos, + ]; } /** diff --git a/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php b/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php index 816483f325..b3ae5a0030 100644 --- a/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php +++ b/libraries/classes/Plugins/Schema/Dia/TableStatsDia.php @@ -102,7 +102,7 @@ class TableStatsDia extends TableStats $listOfColors = [ 'FF0000', '000099', - '00FF00' + '00FF00', ]; shuffle($listOfColors); $this->tableColor = '#' . $listOfColors[0] . ''; diff --git a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php index 0e70d6e82c..1c05b849f5 100644 --- a/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php +++ b/libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php @@ -702,7 +702,17 @@ class PdfRelationSchema extends ExportRelationSchema $this->diagram->Cell($comments_width, 8, __('Comments'), 1, 0, 'C'); $this->diagram->Cell(45, 8, 'MIME', 1, 1, 'C'); $this->diagram->setWidths( - [25, 20, 20, 10, 20, 25, 45, $comments_width, 45] + [ + 25, + 20, + 20, + 10, + 20, + 25, + 45, + $comments_width, + 45, + ] ); } else { $this->diagram->Cell(20, 8, __('Column'), 1, 0, 'C'); @@ -769,15 +779,14 @@ class PdfRelationSchema extends ExportRelationSchema : ''), (isset($mime_map) && isset($mime_map[$field_name]) ? str_replace('_', '/', $mime_map[$field_name]['mimetype']) - : '') + : ''), ]; $links = []; $links[0] = $this->diagram->PMA_links['RT'][$table][$field_name]; if ($foreigner && isset($this->diagram->PMA_links['doc'][$foreigner['foreign_table']][$foreigner['foreign_field']]) ) { - $links[6] = $this->diagram->PMA_links['doc'] - [$foreigner['foreign_table']][$foreigner['foreign_field']]; + $links[6] = $this->diagram->PMA_links['doc'][$foreigner['foreign_table']][$foreigner['foreign_field']]; } else { unset($links[6]); } diff --git a/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php b/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php index 4495e847d3..aaf1d15d6a 100644 --- a/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php +++ b/libraries/classes/Plugins/Schema/Pdf/RelationStatsPdf.php @@ -72,12 +72,36 @@ class RelationStatsPdf extends RelationStats $j = $j % 4; $j++; $case = [ - [1, 0, 0], - [0, 1, 0], - [0, 0, 1], - [1, 1, 0], - [1, 0, 1], - [0, 1, 1] + [ + 1, + 0, + 0, + ], + [ + 0, + 1, + 0, + ], + [ + 0, + 0, + 1, + ], + [ + 1, + 1, + 0, + ], + [ + 1, + 0, + 1, + ], + [ + 0, + 1, + 1, + ], ]; list ($a, $b, $c) = $case[$d]; $e = (1 - ($j - 1) / 6); diff --git a/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php b/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php index 96fb09b664..eeef780b88 100644 --- a/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php +++ b/libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php @@ -114,8 +114,14 @@ abstract class ExternalTransformationsPlugin extends TransformationsPlugin // needs PHP >= 4.3.0 $newstring = ''; $descriptorspec = [ - 0 => ["pipe", "r"], - 1 => ["pipe", "w"], + 0 => [ + "pipe", + "r", + ], + 1 => [ + "pipe", + "w", + ], ]; $process = proc_open($program . ' ' . $options[1], $descriptorspec, $pipes); if (is_resource($process)) { diff --git a/libraries/classes/Properties/Options/OptionsPropertyGroup.php b/libraries/classes/Properties/Options/OptionsPropertyGroup.php index 9bf59487c4..e91ad32af6 100644 --- a/libraries/classes/Properties/Options/OptionsPropertyGroup.php +++ b/libraries/classes/Properties/Options/OptionsPropertyGroup.php @@ -40,7 +40,7 @@ abstract class OptionsPropertyGroup extends OptionsPropertyItem implements \Coun ) { return; } - $this->_properties [] = $property; + $this->_properties[] = $property; } /** diff --git a/libraries/classes/RecentFavoriteTable.php b/libraries/classes/RecentFavoriteTable.php index ca747e6e17..6b1d5fce48 100644 --- a/libraries/classes/RecentFavoriteTable.php +++ b/libraries/classes/RecentFavoriteTable.php @@ -190,7 +190,7 @@ class RecentFavoriteTable $html .= '<li class="warp_link">'; $recent_params = [ 'db' => $table['db'], - 'table' => $table['table'] + 'table' => $table['table'], ]; $recent_url = 'tbl_recent_favorite.php' . Url::getCommon($recent_params); @@ -208,7 +208,7 @@ class RecentFavoriteTable 'db' => $table['db'], 'ajax_request' => true, 'favorite_table' => $table['table'], - 'remove_favorite' => true + 'remove_favorite' => true, ]; $fav_rm_url = 'db_structure.php' . Url::getCommon($fav_params); @@ -222,7 +222,7 @@ class RecentFavoriteTable $fav_params = [ 'db' => $table['db'], - 'table' => $table['table'] + 'table' => $table['table'], ]; $table_url = 'tbl_recent_favorite.php' . Url::getCommon($fav_params); @@ -359,7 +359,7 @@ class RecentFavoriteTable $params = [ 'ajax_request' => true, 'favorite_table' => true, - 'sync_favorite_tables' => true + 'sync_favorite_tables' => true, ]; $url = 'db_structure.php' . Url::getCommon($params); $retval = '<a class="hide" id="sync_favorite_tables"'; @@ -375,7 +375,10 @@ class RecentFavoriteTable */ public static function getHtmlUpdateRecentTables() { - $params = ['ajax_request' => true, 'recent_table' => true]; + $params = [ + 'ajax_request' => true, + 'recent_table' => true, + ]; $url = 'index.php' . Url::getCommon($params); $retval = '<a class="hide" id="update_recent_tables"'; $retval .= ' href="' . $url . '"></a>'; diff --git a/libraries/classes/Relation.php b/libraries/classes/Relation.php index c690de3227..60bfe8a967 100644 --- a/libraries/classes/Relation.php +++ b/libraries/classes/Relation.php @@ -487,9 +487,15 @@ class Relation $workToTable = [ 'relwork' => 'relation', - 'displaywork' => ['relation', 'table_info'], + 'displaywork' => [ + 'relation', + 'table_info', + ], 'bookmarkwork' => 'bookmarktable', - 'pdfwork' => ['table_coords', 'pdf_pages'], + 'pdfwork' => [ + 'table_coords', + 'pdf_pages', + ], 'commwork' => 'column_info', 'mimework' => 'column_info', 'historywork' => 'history', @@ -498,7 +504,10 @@ class Relation 'uiprefswork' => 'table_uiprefs', 'trackingwork' => 'tracking', 'userconfigwork' => 'userconfig', - 'menuswork' => ['users', 'usergroups'], + 'menuswork' => [ + 'users', + 'usergroups', + ], 'navwork' => 'navigationhiding', 'savedsearcheswork' => 'savedsearches', 'centralcolumnswork' => 'central_columns', @@ -711,7 +720,7 @@ class Relation // Check whether column_info table has input transformation columns $new_cols = [ "input_transformation", - "input_transformation_options" + "input_transformation_options", ]; $query = 'SHOW COLUMNS FROM ' . Util::backquote($GLOBALS['cfg']['Server']['pmadb']) @@ -1834,7 +1843,10 @@ class Relation $child_references = $this->dbi->fetchResult( $rel_query, - ['referenced_column_name', null] + [ + 'referenced_column_name', + null, + ] ); } return $child_references; @@ -2155,7 +2167,10 @@ class Relation $have_rel = false; $res_rel = []; } // end if - return [$res_rel, $have_rel]; + return [ + $res_rel, + $have_rel, + ]; } /** diff --git a/libraries/classes/ReplicationGui.php b/libraries/classes/ReplicationGui.php index fa614b24ae..eb284c5a65 100644 --- a/libraries/classes/ReplicationGui.php +++ b/libraries/classes/ReplicationGui.php @@ -432,7 +432,10 @@ class ReplicationGui $html .= '<pre>server-id=' . time() . '</pre>'; $html .= $this->getHtmlForAddUserInputDiv( - ['text' => __('User name:'), 'for' => "text_username"], + [ + 'text' => __('User name:'), + 'for' => "text_username" + ], [ 'type' => 'text', 'name' => 'username', @@ -444,18 +447,24 @@ class ReplicationGui ); $html .= $this->getHtmlForAddUserInputDiv( - ['text' => __('Password:'), 'for' => "text_pma_pw"], + [ + 'text' => __('Password:'), + 'for' => "text_pma_pw" + ], [ 'type' => 'password', 'name' => 'pma_pw', 'id' => 'text_pma_pw', 'title' => __('Password'), - 'required' => 'required' + 'required' => 'required', ] ); $html .= $this->getHtmlForAddUserInputDiv( - ['text' => __('Host:'), 'for' => "text_hostname"], + [ + 'text' => __('Host:'), + 'for' => "text_hostname" + ], [ 'type' => 'text', 'name' => 'hostname', @@ -467,7 +476,10 @@ class ReplicationGui ); $html .= $this->getHtmlForAddUserInputDiv( - ['text' => __('Port:'), 'for' => "text_port"], + [ + 'text' => __('Port:'), + 'for' => "text_port" + ], [ 'type' => 'number', 'name' => 'text_port', @@ -590,9 +602,12 @@ class ReplicationGui } // allow wrapping long table lists into multiple lines $variables_wrap = [ - 'Replicate_Do_DB', 'Replicate_Ignore_DB', - 'Replicate_Do_Table', 'Replicate_Ignore_Table', - 'Replicate_Wild_Do_Table', 'Replicate_Wild_Ignore_Table' + 'Replicate_Do_DB', + 'Replicate_Ignore_DB', + 'Replicate_Do_Table', + 'Replicate_Ignore_Table', + 'Replicate_Wild_Do_Table', + 'Replicate_Wild_Ignore_Table', ]; if (in_array($variable, $variables_wrap)) { $html .= htmlspecialchars(str_replace( @@ -690,7 +705,10 @@ class ReplicationGui } } } - return [$username_length, $hostname_length]; + return [ + $username_length, + $hostname_length, + ]; } /** diff --git a/libraries/classes/Response.php b/libraries/classes/Response.php index d21088bf0e..de039357ad 100644 --- a/libraries/classes/Response.php +++ b/libraries/classes/Response.php @@ -436,7 +436,7 @@ class Response [ 'db' => Core::ifSetOr($GLOBALS['db'], ''), 'table' => Core::ifSetOr($GLOBALS['table'], ''), - 'sql_query' => $query + 'sql_query' => $query, ] ); if (! empty($GLOBALS['focus_querywindow'])) { diff --git a/libraries/classes/Rte/Events.php b/libraries/classes/Rte/Events.php index e0915c0f63..15dabc7e91 100644 --- a/libraries/classes/Rte/Events.php +++ b/libraries/classes/Rte/Events.php @@ -329,7 +329,7 @@ class Events 'item_definition', 'item_preserve', 'item_comment', - 'item_definer' + 'item_definer', ]; foreach ($indices as $index) { $retval[$index] = isset($_POST[$index]) ? $_POST[$index] : ''; @@ -423,7 +423,7 @@ class Events 'item_ends', 'item_definition', 'item_definer', - 'item_comment' + 'item_comment', ]; foreach ($need_escape as $index) { $item[$index] = htmlentities((string) $item[$index], ENT_QUOTES); diff --git a/libraries/classes/Rte/Footer.php b/libraries/classes/Rte/Footer.php index a948c032be..fd11484677 100644 --- a/libraries/classes/Rte/Footer.php +++ b/libraries/classes/Rte/Footer.php @@ -125,13 +125,13 @@ class Footer 0 => [ 'label' => __('OFF'), 'value' => "SET GLOBAL event_scheduler=\"OFF\"", - 'selected' => ($es_state != 'on') + 'selected' => ($es_state != 'on'), ], 1 => [ 'label' => __('ON'), 'value' => "SET GLOBAL event_scheduler=\"ON\"", - 'selected' => ($es_state == 'on') - ] + 'selected' => ($es_state == 'on'), + ], ]; // Generate output $retval = "<!-- FOOTER LINKS START -->\n"; diff --git a/libraries/classes/Rte/Routines.php b/libraries/classes/Rte/Routines.php index a36227468b..16acf5f91e 100644 --- a/libraries/classes/Rte/Routines.php +++ b/libraries/classes/Rte/Routines.php @@ -127,7 +127,7 @@ class Routines /** * Display a list of available routines */ - if (! Core::isValid($type, ['FUNCTION','PROCEDURE'])) { + if (! Core::isValid($type, ['FUNCTION', 'PROCEDURE'])) { $type = null; } $items = $this->dbi->getRoutines($db, $type); @@ -267,7 +267,10 @@ class Routines if (! empty($_POST['editor_process_edit'])) { $isProcOrFunc = in_array( $_POST['item_original_type'], - ['PROCEDURE', 'FUNCTION'] + [ + 'PROCEDURE', + 'FUNCTION', + ] ); if (! $isProcOrFunc) { @@ -451,7 +454,10 @@ class Routines $errors ); - return [$errors, null]; + return [ + $errors, + null, + ]; } // Default value @@ -481,7 +487,10 @@ class Routines $message = $this->flushPrivileges($resultAdjust); - return [[], $message]; + return [ + [], + $message, + ]; } /** @@ -536,7 +545,7 @@ class Routines 'item_returnopts_text', 'item_definition', 'item_comment', - 'item_definer' + 'item_definer', ]; foreach ($indices as $index) { $retval[$index] = isset($_POST[$index]) ? $_POST[$index] : ''; @@ -767,7 +776,7 @@ class Routines 'item_param_type' => [0 => ''], 'item_param_length' => [0 => ''], 'item_param_opts_num' => [0 => ''], - 'item_param_opts_text' => [0 => ''] + 'item_param_opts_text' => [0 => ''], ]; } elseif (! empty($routine)) { // regular row for routine editor @@ -879,7 +888,7 @@ class Routines 'item_returnlength', 'item_definition', 'item_definer', - 'item_comment' + 'item_comment', ]; foreach ($need_escape as $key => $index) { $routine[$index] = htmlentities($routine[$index], ENT_QUOTES, 'UTF-8'); @@ -1709,7 +1718,7 @@ class Routines 'Key' => '', 'Field' => '', 'Default' => '', - 'first_timestamp' => false + 'first_timestamp' => false, ]; $retval .= "<select name='funcs[" . $routine['item_param_name'][$i] . "]'>"; diff --git a/libraries/classes/Rte/Triggers.php b/libraries/classes/Rte/Triggers.php index e52934a147..1177af5a2d 100644 --- a/libraries/classes/Rte/Triggers.php +++ b/libraries/classes/Rte/Triggers.php @@ -302,7 +302,7 @@ class Triggers 'item_action_timing', 'item_event_manipulation', 'item_definition', - 'item_definer' + 'item_definer', ]; foreach ($indices as $index) { $retval[$index] = isset($_POST[$index]) ? $_POST[$index] : ''; @@ -367,7 +367,7 @@ class Triggers 'item_original_name', 'item_name', 'item_definition', - 'item_definer' + 'item_definer', ]; foreach ($need_escape as $key => $index) { $item[$index] = htmlentities($item[$index], ENT_QUOTES, 'UTF-8'); diff --git a/libraries/classes/SavedSearches.php b/libraries/classes/SavedSearches.php index 63a94af0ce..b516801d8c 100644 --- a/libraries/classes/SavedSearches.php +++ b/libraries/classes/SavedSearches.php @@ -165,7 +165,7 @@ class SavedSearches 'criteriaAndOrRow', 'criteriaAndOrColumn', 'rows', - 'TableList' + 'TableList', ]; $data = []; @@ -329,7 +329,7 @@ class SavedSearches //Else, it's an update. $wheres = [ "id != " . $this->getId(), - "search_name = '" . $GLOBALS['dbi']->escapeString($this->getSearchName()) . "'" + "search_name = '" . $GLOBALS['dbi']->escapeString($this->getSearchName()) . "'", ]; $existingSearches = $this->getList($wheres); diff --git a/libraries/classes/Scripts.php b/libraries/classes/Scripts.php index 4843023dc9..8a1829fee6 100644 --- a/libraries/classes/Scripts.php +++ b/libraries/classes/Scripts.php @@ -160,7 +160,7 @@ class Scripts } $retval[] = [ 'name' => $file['filename'], - 'fire' => $file['has_onload'] + 'fire' => $file['has_onload'], ]; } return $retval; diff --git a/libraries/classes/Server/Privileges.php b/libraries/classes/Server/Privileges.php index 6e5736c537..01887c3808 100644 --- a/libraries/classes/Server/Privileges.php +++ b/libraries/classes/Server/Privileges.php @@ -291,42 +291,42 @@ class Privileges [ 'Delete', 'DELETE', - $GLOBALS['strPrivDescDelete'] + $GLOBALS['strPrivDescDelete'], ], [ 'Create', 'CREATE', - $GLOBALS['strPrivDescCreateTbl'] + $GLOBALS['strPrivDescCreateTbl'], ], [ 'Drop', 'DROP', - $GLOBALS['strPrivDescDropTbl'] + $GLOBALS['strPrivDescDropTbl'], ], [ 'Index', 'INDEX', - $GLOBALS['strPrivDescIndex'] + $GLOBALS['strPrivDescIndex'], ], [ 'Alter', 'ALTER', - $GLOBALS['strPrivDescAlter'] + $GLOBALS['strPrivDescAlter'], ], [ 'Create View', 'CREATE_VIEW', - $GLOBALS['strPrivDescCreateView'] + $GLOBALS['strPrivDescCreateView'], ], [ 'Show view', 'SHOW_VIEW', - $GLOBALS['strPrivDescShowView'] + $GLOBALS['strPrivDescShowView'], ], [ 'Trigger', 'TRIGGER', - $GLOBALS['strPrivDescTrigger'] + $GLOBALS['strPrivDescTrigger'], ], ]; } @@ -343,72 +343,72 @@ class Privileges [ 'Select_priv', 'SELECT', - __('Allows reading data.') + __('Allows reading data.'), ], [ 'Insert_priv', 'INSERT', - __('Allows inserting and replacing data.') + __('Allows inserting and replacing data.'), ], [ 'Update_priv', 'UPDATE', - __('Allows changing data.') + __('Allows changing data.'), ], [ 'Delete_priv', 'DELETE', - __('Allows deleting data.') + __('Allows deleting data.'), ], [ 'Create_priv', 'CREATE', - __('Allows creating new databases and tables.') + __('Allows creating new databases and tables.'), ], [ 'Drop_priv', 'DROP', - __('Allows dropping databases and tables.') + __('Allows dropping databases and tables.'), ], [ 'Reload_priv', 'RELOAD', - __('Allows reloading server settings and flushing the server\'s caches.') + __('Allows reloading server settings and flushing the server\'s caches.'), ], [ 'Shutdown_priv', 'SHUTDOWN', - __('Allows shutting down the server.') + __('Allows shutting down the server.'), ], [ 'Process_priv', 'PROCESS', - __('Allows viewing processes of all users.') + __('Allows viewing processes of all users.'), ], [ 'File_priv', 'FILE', - __('Allows importing data from and exporting data into files.') + __('Allows importing data from and exporting data into files.'), ], [ 'References_priv', 'REFERENCES', - __('Has no effect in this MySQL version.') + __('Has no effect in this MySQL version.'), ], [ 'Index_priv', 'INDEX', - __('Allows creating and dropping indexes.') + __('Allows creating and dropping indexes.'), ], [ 'Alter_priv', 'ALTER', - __('Allows altering the structure of existing tables.') + __('Allows altering the structure of existing tables.'), ], [ 'Show_db_priv', 'SHOW DATABASES', - __('Gives access to the complete list of databases.') + __('Gives access to the complete list of databases.'), ], [ 'Super_priv', @@ -417,79 +417,79 @@ class Privileges 'Allows connecting, even if maximum number of connections ' . 'is reached; required for most administrative operations ' . 'like setting global variables or killing threads of other users.' - ) + ), ], [ 'Create_tmp_table_priv', 'CREATE TEMPORARY TABLES', - __('Allows creating temporary tables.') + __('Allows creating temporary tables.'), ], [ 'Lock_tables_priv', 'LOCK TABLES', - __('Allows locking tables for the current thread.') + __('Allows locking tables for the current thread.'), ], [ 'Repl_slave_priv', 'REPLICATION SLAVE', - __('Needed for the replication slaves.') + __('Needed for the replication slaves.'), ], [ 'Repl_client_priv', 'REPLICATION CLIENT', - __('Allows the user to ask where the slaves / masters are.') + __('Allows the user to ask where the slaves / masters are.'), ], [ 'Create_view_priv', 'CREATE VIEW', - __('Allows creating new views.') + __('Allows creating new views.'), ], [ 'Event_priv', 'EVENT', - __('Allows to set up events for the event scheduler.') + __('Allows to set up events for the event scheduler.'), ], [ 'Trigger_priv', 'TRIGGER', - __('Allows creating and dropping triggers.') + __('Allows creating and dropping triggers.'), ], // for table privs: [ 'Create View_priv', 'CREATE VIEW', - __('Allows creating new views.') + __('Allows creating new views.'), ], [ 'Show_view_priv', 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.') + __('Allows performing SHOW CREATE VIEW queries.'), ], // for table privs: [ 'Show view_priv', 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.') + __('Allows performing SHOW CREATE VIEW queries.'), ], [ 'Create_routine_priv', 'CREATE ROUTINE', - __('Allows creating stored routines.') + __('Allows creating stored routines.'), ], [ 'Alter_routine_priv', 'ALTER ROUTINE', - __('Allows altering and dropping stored routines.') + __('Allows altering and dropping stored routines.'), ], [ 'Create_user_priv', 'CREATE USER', - __('Allows creating, dropping and renaming user accounts.') + __('Allows creating, dropping and renaming user accounts.'), ], [ 'Execute_priv', 'EXECUTE', - __('Allows executing stored routines.') + __('Allows executing stored routines.'), ], ]; } @@ -524,7 +524,7 @@ class Privileges 'priv_for_header' => $priv_for_header, 'name' => $name, 'name_for_dfn' => $name_for_dfn, - 'name_for_current' => $name_for_current + 'name_for_current' => $name_for_current, ]); } @@ -732,7 +732,7 @@ class Privileges 'Select' => false, 'Insert' => false, 'Update' => false, - 'References' => false + 'References' => false, ]; } $this->dbi->freeResult($res); @@ -789,7 +789,7 @@ class Privileges : '' ), 'disabled' => false, - 'radio' => true + 'radio' => true, ], [ 'name' => 'ssl_type', @@ -803,7 +803,7 @@ class Privileges : '' ), 'disabled' => false, - 'radio' => true + 'radio' => true, ], [ 'name' => 'ssl_type', @@ -817,7 +817,7 @@ class Privileges : '' ), 'disabled' => false, - 'radio' => true + 'radio' => true, ], [ 'name' => 'ssl_type', @@ -826,7 +826,7 @@ class Privileges 'label' => 'SPECIFIED', 'checked' => ($specified ? 'checked="checked"' : ''), 'disabled' => false, - 'radio' => true + 'radio' => true, ], [ 'name' => 'ssl_cipher', @@ -839,7 +839,7 @@ class Privileges 'label' => 'REQUIRE CIPHER', 'checked' => '', 'disabled' => ! $specified, - 'radio' => false + 'radio' => false, ], [ 'name' => 'x509_issuer', @@ -852,7 +852,7 @@ class Privileges 'label' => 'REQUIRE ISSUER', 'checked' => '', 'disabled' => ! $specified, - 'radio' => false + 'radio' => false, ], [ 'name' => 'x509_subject', @@ -865,12 +865,12 @@ class Privileges 'label' => 'REQUIRE SUBJECT', 'checked' => '', 'disabled' => ! $specified, - 'radio' => false + 'radio' => false, ], ]; return $this->template->render('server/privileges/require_options', [ - 'require_options' => $require_options + 'require_options' => $require_options, ]); } @@ -890,7 +890,7 @@ class Privileges 'value' => (isset($row['max_questions']) ? $row['max_questions'] : '0'), 'description' => __( 'Limits the number of queries the user may send to the server per hour.' - ) + ), ], [ 'input_name' => 'max_updates', @@ -899,7 +899,7 @@ class Privileges 'description' => __( 'Limits the number of commands that change any table ' . 'or database the user may execute per hour.' - ) + ), ], [ 'input_name' => 'max_connections', @@ -907,7 +907,7 @@ class Privileges 'value' => (isset($row['max_connections']) ? $row['max_connections'] : '0'), 'description' => __( 'Limits the number of new connections the user may open per hour.' - ) + ), ], [ 'input_name' => 'max_user_connections', @@ -917,12 +917,12 @@ class Privileges 'description' => __( 'Limits the number of simultaneous connections ' . 'the user may have.' - ) - ] + ), + ], ]; $html_output = $this->template->render('server/privileges/resource_limits', [ - 'limits' => $limits + 'limits' => $limits, ]); $html_output .= '</fieldset>' . "\n"; @@ -1002,18 +1002,18 @@ class Privileges __( 'Allows user to give to other users or remove from other users ' . 'privileges that user possess on this routine.' - ) + ), ], [ 'Alter_routine', 'ALTER ROUTINE', - __('Allows altering and dropping this routine.') + __('Allows altering and dropping this routine.'), ], [ 'Execute', 'EXECUTE', - __('Allows executing this routine.') - ] + __('Allows executing this routine.'), + ], ]; return $routinePrivTable; } @@ -1229,9 +1229,10 @@ class Privileges */ public function getHtmlForGlobalOrDbSpecificPrivs($db, $table, array $row) { - $privTable_names = [0 => __('Data'), + $privTable_names = [ + 0 => __('Data'), 1 => __('Structure'), - 2 => __('Administration') + 2 => __('Administration'), ]; $privTable = []; $privTable[0] = $this->getDataPrivilegeTable($db); @@ -1293,16 +1294,33 @@ class Privileges public function getDataPrivilegeTable($db) { $data_privTable = [ - ['Select', 'SELECT', __('Allows reading data.')], - ['Insert', 'INSERT', __('Allows inserting and replacing data.')], - ['Update', 'UPDATE', __('Allows changing data.')], - ['Delete', 'DELETE', __('Allows deleting data.')] + [ + 'Select', + 'SELECT', + __('Allows reading data.'), + ], + [ + 'Insert', + 'INSERT', + __('Allows inserting and replacing data.'), + ], + [ + 'Update', + 'UPDATE', + __('Allows changing data.'), + ], + [ + 'Delete', + 'DELETE', + __('Allows deleting data.'), + ], ]; if ($db == '*') { $data_privTable[] - = ['File', + = [ + 'File', 'FILE', - __('Allows importing data from and exporting data into files.') + __('Allows importing data from and exporting data into files.'), ]; } return $data_privTable; @@ -1319,66 +1337,85 @@ class Privileges public function getStructurePrivilegeTable($table, array $row) { $structure_privTable = [ - ['Create', + [ + 'Create', 'CREATE', ($table == '*' ? __('Allows creating new databases and tables.') : __('Allows creating new tables.') - ) + ), ], - ['Alter', + [ + 'Alter', 'ALTER', - __('Allows altering the structure of existing tables.') + __('Allows altering the structure of existing tables.'), ], - ['Index', 'INDEX', __('Allows creating and dropping indexes.')], - ['Drop', + [ + 'Index', + 'INDEX', + __('Allows creating and dropping indexes.'), + ], + [ + 'Drop', 'DROP', ($table == '*' ? __('Allows dropping databases and tables.') : __('Allows dropping tables.') - ) + ), ], - ['Create_tmp_table', + [ + 'Create_tmp_table', 'CREATE TEMPORARY TABLES', - __('Allows creating temporary tables.') + __('Allows creating temporary tables.'), ], - ['Show_view', + [ + 'Show_view', 'SHOW VIEW', - __('Allows performing SHOW CREATE VIEW queries.') + __('Allows performing SHOW CREATE VIEW queries.'), ], - ['Create_routine', + [ + 'Create_routine', 'CREATE ROUTINE', - __('Allows creating stored routines.') + __('Allows creating stored routines.'), ], - ['Alter_routine', + [ + 'Alter_routine', 'ALTER ROUTINE', - __('Allows altering and dropping stored routines.') + __('Allows altering and dropping stored routines.'), + ], + [ + 'Execute', + 'EXECUTE', + __('Allows executing stored routines.'), ], - ['Execute', 'EXECUTE', __('Allows executing stored routines.')], ]; // this one is for a db-specific priv: Create_view_priv if (isset($row['Create_view_priv'])) { - $structure_privTable[] = ['Create_view', + $structure_privTable[] = [ + 'Create_view', 'CREATE VIEW', - __('Allows creating new views.') + __('Allows creating new views.'), ]; } // this one is for a table-specific priv: Create View_priv if (isset($row['Create View_priv'])) { - $structure_privTable[] = ['Create View', + $structure_privTable[] = [ + 'Create View', 'CREATE VIEW', - __('Allows creating new views.') + __('Allows creating new views.'), ]; } if (isset($row['Event_priv'])) { // MySQL 5.1.6 - $structure_privTable[] = ['Event', + $structure_privTable[] = [ + 'Event', 'EVENT', - __('Allows to set up events for the event scheduler.') + __('Allows to set up events for the event scheduler.'), ]; - $structure_privTable[] = ['Trigger', + $structure_privTable[] = [ + 'Trigger', 'TRIGGER', - __('Allows creating and dropping triggers.') + __('Allows creating and dropping triggers.'), ]; } return $structure_privTable; @@ -1395,70 +1432,82 @@ class Privileges { if ($db == '*') { $adminPrivTable = [ - ['Grant', + [ + 'Grant', 'GRANT', __( 'Allows adding users and privileges ' . 'without reloading the privilege tables.' - ) + ), ], ]; - $adminPrivTable[] = ['Super', + $adminPrivTable[] = [ + 'Super', 'SUPER', __( 'Allows connecting, even if maximum number ' . 'of connections is reached; required for ' . 'most administrative operations like ' . 'setting global variables or killing threads of other users.' - ) + ), ]; - $adminPrivTable[] = ['Process', + $adminPrivTable[] = [ + 'Process', 'PROCESS', - __('Allows viewing processes of all users.') + __('Allows viewing processes of all users.'), ]; - $adminPrivTable[] = ['Reload', + $adminPrivTable[] = [ + 'Reload', 'RELOAD', - __('Allows reloading server settings and flushing the server\'s caches.') + __('Allows reloading server settings and flushing the server\'s caches.'), ]; - $adminPrivTable[] = ['Shutdown', + $adminPrivTable[] = [ + 'Shutdown', 'SHUTDOWN', - __('Allows shutting down the server.') + __('Allows shutting down the server.'), ]; - $adminPrivTable[] = ['Show_db', + $adminPrivTable[] = [ + 'Show_db', 'SHOW DATABASES', - __('Gives access to the complete list of databases.') + __('Gives access to the complete list of databases.'), ]; } else { $adminPrivTable = [ - ['Grant', + [ + 'Grant', 'GRANT', __( 'Allows user to give to other users or remove from other' . ' users the privileges that user possess yourself.' - ) + ), ], ]; } - $adminPrivTable[] = ['Lock_tables', + $adminPrivTable[] = [ + 'Lock_tables', 'LOCK TABLES', - __('Allows locking tables for the current thread.') + __('Allows locking tables for the current thread.'), ]; - $adminPrivTable[] = ['References', + $adminPrivTable[] = [ + 'References', 'REFERENCES', - __('Has no effect in this MySQL version.') + __('Has no effect in this MySQL version.'), ]; if ($db == '*') { - $adminPrivTable[] = ['Repl_client', + $adminPrivTable[] = [ + 'Repl_client', 'REPLICATION CLIENT', - __('Allows the user to ask where the slaves / masters are.') + __('Allows the user to ask where the slaves / masters are.'), ]; - $adminPrivTable[] = ['Repl_slave', + $adminPrivTable[] = [ + 'Repl_slave', 'REPLICATION SLAVE', - __('Needed for the replication slaves.') + __('Needed for the replication slaves.'), ]; - $adminPrivTable[] = ['Create_user', + $adminPrivTable[] = [ + 'Create_user', 'CREATE USER', - __('Allows creating, dropping and renaming user accounts.') + __('Allows creating, dropping and renaming user accounts.'), ]; } return $adminPrivTable; @@ -1513,7 +1562,7 @@ class Privileges } } else { $active_auth_plugins = [ - 'mysql_native_password' => __('Native MySQL authentication') + 'mysql_native_password' => __('Native MySQL authentication'), ]; } @@ -1858,7 +1907,10 @@ class Privileges $hostname_length = $val['CHARACTER_MAXIMUM_LENGTH']; } } - return [$username_length, $hostname_length]; + return [ + $username_length, + $hostname_length, + ]; } /** @@ -2149,7 +2201,10 @@ class Privileges ); $message->addParam('\'' . $username . '\'@\'' . $hostname . '\''); - return [$message, $sql_query]; + return [ + $message, + $sql_query, + ]; } /** @@ -2353,7 +2408,10 @@ class Privileges $listOfComparedPrivs .= ' AND `Event_priv` = \'N\'' . ' AND `Trigger_priv` = \'N\''; - return [$list_of_privileges, $listOfComparedPrivs]; + return [ + $list_of_privileges, + $listOfComparedPrivs, + ]; } /** @@ -2897,7 +2955,7 @@ class Privileges } $params = [ 'username' => $username, - 'hostname' => $hostname + 'hostname' => $hostname, ]; switch ($linktype) { case 'edit': @@ -3187,7 +3245,7 @@ class Privileges '3' => __( '… delete the old one from the user tables ' . 'and reload the privileges afterwards.' - ) + ), ]; $html_output = '<form action="server_privileges.php" ' @@ -3253,7 +3311,7 @@ class Privileges . Url::getCommon( [ 'db' => $url_dbname, - 'reload' => 1 + 'reload' => 1, ] ) . '">' @@ -3306,18 +3364,20 @@ class Privileges if ($type == 'database') { $tables_to_search_for_users = [ - 'tables_priv', 'columns_priv', 'procs_priv' + 'tables_priv', + 'columns_priv', + 'procs_priv', ]; $dbOrTableName = 'Db'; } elseif ($type == 'table') { $user_host_condition .= " AND `Db` LIKE '" . $this->dbi->escapeString($dbname) . "'"; - $tables_to_search_for_users = ['columns_priv',]; + $tables_to_search_for_users = ['columns_priv']; $dbOrTableName = 'Table_name'; } else { // routine $user_host_condition .= " AND `Db` LIKE '" . $this->dbi->escapeString($dbname) . "'"; - $tables_to_search_for_users = ['procs_priv',]; + $tables_to_search_for_users = ['procs_priv']; $dbOrTableName = 'Routine_name'; } @@ -3554,7 +3614,10 @@ class Privileges // we already have the list of databases from libraries/common.inc.php // via $pma = new PMA; $pred_db_array = $GLOBALS['dblist']->databases; - $databases_to_skip = ['information_schema', 'performance_schema']; + $databases_to_skip = [ + 'information_schema', + 'performance_schema', + ]; $databases = []; if (! empty($pred_db_array)) { @@ -3889,7 +3952,11 @@ class Privileges $tables = $this->dbi->fetchResult('SHOW TABLES FROM `mysql`;'); $tablesSearchForUsers = [ - 'user', 'db', 'tables_priv', 'columns_priv', 'procs_priv', + 'user', + 'db', + 'tables_priv', + 'columns_priv', + 'procs_priv', ]; $db_rights_sqls = []; @@ -3966,7 +4033,10 @@ class Privileges ); } } - return [$sql_query, $message]; + return [ + $sql_query, + $message, + ]; } /** @@ -4040,7 +4110,10 @@ class Privileges $message = Message::success(__('You have updated the privileges for %s.')); $message->addParam('\'' . $username . '\'@\'' . $hostname . '\''); - return [$sql_query, $message]; + return [ + $sql_query, + $message, + ]; } /** @@ -4111,7 +4184,10 @@ class Privileges } } - return [$queries, $password]; + return [ + $queries, + $password, + ]; } /** @@ -4234,7 +4310,11 @@ class Privileges if (! isset($_POST['adduser_submit']) && ! isset($_POST['change_copy'])) { return [ - $message, $queries, $queries_for_display, $sql_query, $_add_user_error + $message, + $queries, + $queries_for_display, + $sql_query, + $_add_user_error, ]; } @@ -4275,7 +4355,7 @@ class Privileges $queries, $queries_for_display, $sql_query, - $_add_user_error + $_add_user_error, ]; } @@ -4333,7 +4413,7 @@ class Privileges $queries, $queries_for_display, $sql_query, - $_add_user_error + $_add_user_error, ]; } @@ -4372,7 +4452,11 @@ class Privileges } return [ - $message, $queries, $queries_for_display, $sql_query, $_add_user_error + $message, + $queries, + $queries_for_display, + $sql_query, + $_add_user_error, ]; } @@ -4511,7 +4595,8 @@ class Privileges } return [ - $username, $hostname, + $username, + $hostname, isset($dbname) ? $dbname : null, isset($tablename) ? $tablename : null, isset($routinename) ? $routinename : null, @@ -4569,7 +4654,10 @@ class Privileges $export .= '</textarea>'; - return [$title, $export]; + return [ + $title, + $export, + ]; } /** @@ -4587,7 +4675,7 @@ class Privileges } $rel_params = []; $url_params = [ - 'adduser' => 1 + 'adduser' => 1, ]; if (! empty($db)) { $url_params['dbname'] @@ -4602,7 +4690,7 @@ class Privileges return $this->template->render('server/privileges/add_user_fieldset', [ 'url_params' => $url_params, - 'rel_params' => $rel_params + 'rel_params' => $rel_params, ]); } @@ -5046,7 +5134,7 @@ class Privileges 'Select' => [], 'Insert' => [], 'Update' => [], - 'References' => [] + 'References' => [], ]; while ($row2 = $this->dbi->fetchAssoc($res2)) { @@ -5234,7 +5322,10 @@ class Privileges $message = Message::rawError($this->dbi->getError()); } } - return [$sql_query, $message]; + return [ + $sql_query, + $message, + ]; } /** diff --git a/libraries/classes/Server/Status/Data.php b/libraries/classes/Server/Status/Data.php index 5108052c1e..94e7e7a73e 100644 --- a/libraries/classes/Server/Status/Data.php +++ b/libraries/classes/Server/Status/Data.php @@ -310,7 +310,11 @@ class Data $sectionUsed['other'] = true; } } - return [$allocationMap, $sectionUsed, $used_queries]; + return [ + $allocationMap, + $sectionUsed, + $used_queries, + ]; } /** @@ -456,7 +460,7 @@ class Data [ 'name' => __('Advisor'), 'url' => 'server_status_advisor.php' - ] + ], ]; $retval = '<ul id="topmenu2">'; @@ -490,7 +494,18 @@ class Data public static function getHtmlForRefreshList( $name, $defaultRate = 5, - array $refreshRates = [1, 2, 5, 10, 20, 40, 60, 120, 300, 600] + array $refreshRates = [ + 1, + 2, + 5, + 10, + 20, + 40, + 60, + 120, + 300, + 600, + ] ) { $return = '<select name="' . $name . '" id="id_' . $name . '" class="refreshRate">'; diff --git a/libraries/classes/Server/Status/Monitor.php b/libraries/classes/Server/Status/Monitor.php index cdcc725b00..5b7de64148 100644 --- a/libraries/classes/Server/Status/Monitor.php +++ b/libraries/classes/Server/Status/Monitor.php @@ -297,7 +297,20 @@ class Monitor $retval .= Data::getHtmlForRefreshList( 'gridChartRefresh', 5, - [2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200] + [ + 2, + 3, + 4, + 5, + 10, + 20, + 40, + 60, + 120, + 300, + 600, + 1200, + ] ); $retval .= '<br>'; $retval .= '</div>'; @@ -497,7 +510,11 @@ class Monitor } /* foreach */ } /* foreach */ } - return [$serverVars, $statusVars, $ret]; + return [ + $serverVars, + $statusVars, + $ret, + ]; } /** @@ -576,7 +593,11 @@ class Monitor break; } - return [$serverVars, $statusVars, $ret]; + return [ + $serverVars, + $statusVars, + $ret, + ]; } /** @@ -601,7 +622,10 @@ class Monitor $result = $GLOBALS['dbi']->tryQuery($query); - $return = ['rows' => [], 'sum' => []]; + $return = [ + 'rows' => [], + 'sum' => [] + ]; while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { $type = mb_strtolower( @@ -673,7 +697,10 @@ class Monitor $result = $GLOBALS['dbi']->tryQuery($query); - $return = ['rows' => [], 'sum' => []]; + $return = [ + 'rows' => [], + 'sum' => [] + ]; $insertTables = []; $insertTablesFirst = -1; $i = 0; diff --git a/libraries/classes/Server/Status/Processes.php b/libraries/classes/Server/Status/Processes.php index 4daada1242..bfd1e103e6 100644 --- a/libraries/classes/Server/Status/Processes.php +++ b/libraries/classes/Server/Status/Processes.php @@ -41,7 +41,20 @@ class Processes $retval .= Data::getHtmlForRefreshList( 'refreshRate', 5, - [2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200] + [ + 2, + 3, + 4, + 5, + 10, + 20, + 40, + 60, + 120, + 300, + 600, + 1200, + ] ); $retval .= '</label>'; $retval .= '<a id="toggleRefresh" href="#">'; @@ -78,40 +91,40 @@ class Processes $sortable_columns = [ [ 'column_name' => __('ID'), - 'order_by_field' => 'Id' + 'order_by_field' => 'Id', ], [ 'column_name' => __('User'), - 'order_by_field' => 'User' + 'order_by_field' => 'User', ], [ 'column_name' => __('Host'), - 'order_by_field' => 'Host' + 'order_by_field' => 'Host', ], [ 'column_name' => __('Database'), - 'order_by_field' => 'db' + 'order_by_field' => 'db', ], [ 'column_name' => __('Command'), - 'order_by_field' => 'Command' + 'order_by_field' => 'Command', ], [ 'column_name' => __('Time'), - 'order_by_field' => 'Time' + 'order_by_field' => 'Time', ], [ 'column_name' => __('Status'), - 'order_by_field' => 'State' + 'order_by_field' => 'State', ], [ 'column_name' => __('Progress'), - 'order_by_field' => 'Progress' + 'order_by_field' => 'Progress', ], [ 'column_name' => __('SQL query'), - 'order_by_field' => 'Info' - ] + 'order_by_field' => 'Info', + ], ]; $sortableColCount = count($sortable_columns); diff --git a/libraries/classes/Server/UserGroups.php b/libraries/classes/Server/UserGroups.php index 84044d411f..bcf41de364 100644 --- a/libraries/classes/Server/UserGroups.php +++ b/libraries/classes/Server/UserGroups.php @@ -115,7 +115,8 @@ class UserGroups $html_output .= '<a class="" href="server_user_groups.php" data-post="' . Url::getCommon( [ - 'viewUsers' => 1, 'userGroup' => $groupName + 'viewUsers' => 1, + 'userGroup' => $groupName, ], '' ) @@ -126,7 +127,8 @@ class UserGroups $html_output .= '<a class="" href="server_user_groups.php" data-post="' . Url::getCommon( [ - 'editUserGroup' => 1, 'userGroup' => $groupName + 'editUserGroup' => 1, + 'userGroup' => $groupName ], '' ) @@ -137,7 +139,8 @@ class UserGroups . ' href="server_user_groups.php" data-post="' . Url::getCommon( [ - 'deleteUserGroup' => 1, 'userGroup' => $groupName + 'deleteUserGroup' => 1, + 'userGroup' => $groupName ], '' ) @@ -259,7 +262,7 @@ class UserGroups $allowedTabs = [ 'server' => [], 'db' => [], - 'table' => [] + 'table' => [], ]; if ($userGroup != null) { $cfgRelation = $relation->getRelationsParam(); diff --git a/libraries/classes/Server/Users.php b/libraries/classes/Server/Users.php index 0900ef2d02..a497241c4b 100644 --- a/libraries/classes/Server/Users.php +++ b/libraries/classes/Server/Users.php @@ -32,7 +32,7 @@ class Users 'name' => __('User accounts overview'), 'url' => 'server_privileges.php', 'params' => Url::getCommon(['viewing_mode' => 'server']), - ] + ], ]; if ($GLOBALS['dbi']->isSuperuser()) { diff --git a/libraries/classes/Sql.php b/libraries/classes/Sql.php index 97b62e9a7e..c133aa970b 100644 --- a/libraries/classes/Sql.php +++ b/libraries/classes/Sql.php @@ -237,7 +237,7 @@ class Sql $_url_params = [ 'db' => $db, 'table' => $table, - 'field' => $column + 'field' => $column, ]; $dropdown = '<span class="curr_value">' @@ -395,7 +395,11 @@ EOT; = $one_result['Duration']; } } - return [$table, $chart_json, $profiling_stats]; + return [ + $table, + $chart_json, + $profiling_stats, + ]; } /** @@ -1115,7 +1119,10 @@ EOT; // reopen session session_start(); - return [$result, $querytime_after - $querytime_before]; + return [ + $result, + $querytime_after - $querytime_before, + ]; } /** @@ -1389,8 +1396,12 @@ EOT; } } - return [$result, $num_rows, $unlim_num_rows, - isset($profiling_results) ? $profiling_results : null, $extra_data + return [ + $result, + $num_rows, + $unlim_num_rows, + isset($profiling_results) ? $profiling_results : null, + $extra_data, ]; } /** @@ -1590,7 +1601,7 @@ EOT; 'nav_bar' => '0', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ]; $html_output .= $this->getHtmlForSqlQueryResultsTable( @@ -1787,7 +1798,7 @@ EOT; 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ]; $table_html .= $displayResultsObject->getTable( @@ -2075,7 +2086,7 @@ EOT; 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '0', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ]; if ($GLOBALS['dbi']->isSystemSchema($db) || ! $editable) { @@ -2086,7 +2097,7 @@ EOT; 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ]; } if (isset($_POST['printview']) && $_POST['printview'] == '1') { @@ -2097,7 +2108,7 @@ EOT; 'nav_bar' => '0', 'bkm_form' => '0', 'text_btn' => '0', - 'pview_lnk' => '0' + 'pview_lnk' => '0', ]; } diff --git a/libraries/classes/SqlQueryForm.php b/libraries/classes/SqlQueryForm.php index 62c0201b8a..c7cd78955e 100644 --- a/libraries/classes/SqlQueryForm.php +++ b/libraries/classes/SqlQueryForm.php @@ -194,7 +194,11 @@ class SqlQueryForm } $legend .= ': ' . Util::showMySQLDocu('SELECT'); - return [$legend, $query, $columns_list]; + return [ + $legend, + $query, + $columns_list, + ]; } /** diff --git a/libraries/classes/SysInfo.php b/libraries/classes/SysInfo.php index a474f38f66..8fae3a8668 100644 --- a/libraries/classes/SysInfo.php +++ b/libraries/classes/SysInfo.php @@ -34,7 +34,10 @@ class SysInfo public static function getOs($php_os = PHP_OS) { // look for common UNIX-like systems - $unix_like = ['FreeBSD', 'DragonFly']; + $unix_like = [ + 'FreeBSD', + 'DragonFly', + ]; if (in_array($php_os, $unix_like)) { $php_os = 'Linux'; } @@ -50,7 +53,11 @@ class SysInfo public static function get() { $php_os = self::getOs(); - $supported = ['Linux', 'WINNT', 'SunOS']; + $supported = [ + 'Linux', + 'WINNT', + 'SunOS', + ]; if (in_array($php_os, $supported)) { $class_name = 'PhpMyAdmin\SysInfo' . $php_os; diff --git a/libraries/classes/SysInfoWINNT.php b/libraries/classes/SysInfoWINNT.php index 43e8024c95..4709c8dbee 100644 --- a/libraries/classes/SysInfoWINNT.php +++ b/libraries/classes/SysInfoWINNT.php @@ -105,7 +105,10 @@ class SysInfoWINNT extends SysInfoBase { $buffer = $this->_getWMI( "Win32_OperatingSystem", - ['TotalVisibleMemorySize', 'FreePhysicalMemory'] + [ + 'TotalVisibleMemorySize', + 'FreePhysicalMemory', + ] ); $mem = []; $mem['MemTotal'] = $buffer[0]['TotalVisibleMemorySize']; diff --git a/libraries/classes/Table.php b/libraries/classes/Table.php index 253343362d..aa4ec3e897 100644 --- a/libraries/classes/Table.php +++ b/libraries/classes/Table.php @@ -687,7 +687,11 @@ class Table if ($this->_dbi->getCachedTableContent([$db, $table, 'ExactRows']) != null) { $row_count = $this->_dbi->getCachedTableContent( - [$db, $table, 'ExactRows'] + [ + $db, + $table, + 'ExactRows', + ] ); return $row_count; } @@ -700,14 +704,21 @@ class Table $tmp_tables = $this->_dbi->getTablesFull($db, $table); if (isset($tmp_tables[$table])) { $this->_dbi->cacheTableContent( - [$db, $table], + [ + $db, + $table, + ], $tmp_tables[$table] ); } } if ($this->_dbi->getCachedTableContent([$db, $table, 'Rows']) != null) { $row_count = $this->_dbi->getCachedTableContent( - [$db, $table, 'Rows'] + [ + $db, + $table, + 'Rows', + ] ); } else { $row_count = false; @@ -1353,11 +1364,11 @@ class Table $get_fields = ['display_field']; $where_fields = [ 'db_name' => $source_db, - 'table_name' => $source_table + 'table_name' => $source_table, ]; $new_fields = [ 'db_name' => $target_db, - 'table_name' => $target_table + 'table_name' => $target_table, ]; self::duplicateInfo( 'displaywork', @@ -1373,16 +1384,16 @@ class Table $get_fields = [ 'master_field', 'foreign_table', - 'foreign_field' + 'foreign_field', ]; $where_fields = [ 'master_db' => $source_db, - 'master_table' => $source_table + 'master_table' => $source_table, ]; $new_fields = [ 'master_db' => $target_db, 'foreign_db' => $target_db, - 'master_table' => $target_table + 'master_table' => $target_table, ]; self::duplicateInfo( 'relwork', @@ -1395,16 +1406,16 @@ class Table $get_fields = [ 'foreign_field', 'master_table', - 'master_field' + 'master_field', ]; $where_fields = [ 'foreign_db' => $source_db, - 'foreign_table' => $source_table + 'foreign_table' => $source_table, ]; $new_fields = [ 'master_db' => $target_db, 'foreign_db' => $target_db, - 'foreign_table' => $target_table + 'foreign_table' => $target_table, ]; self::duplicateInfo( 'relwork', @@ -1623,7 +1634,10 @@ class Table ); $uniques = $this->_dbi->fetchResult( $sql, - ['Key_name', null], + [ + 'Key_name', + null, + ], 'Column_name' ); @@ -1886,13 +1900,11 @@ class Table // set session variable if it's still undefined if (! isset($_SESSION['tmpval']['table_uiprefs'][$server_id][$this->_db_name][$this->_name])) { // check whether we can get from pmadb - $_SESSION['tmpval']['table_uiprefs'][$server_id][$this->_db_name] - [$this->_name] = $cfgRelation['uiprefswork'] + $_SESSION['tmpval']['table_uiprefs'][$server_id][$this->_db_name][$this->_name] = $cfgRelation['uiprefswork'] ? $this->getUiPrefsFromDb() : []; } - $this->uiprefs =& $_SESSION['tmpval']['table_uiprefs'][$server_id] - [$this->_db_name][$this->_name]; + $this->uiprefs =& $_SESSION['tmpval']['table_uiprefs'][$server_id][$this->_db_name][$this->_name]; } /** @@ -2553,7 +2565,7 @@ class Table $html_output, $preview_sql_data, $display_query, - $seen_error + $seen_error, ]; } diff --git a/libraries/classes/Theme.php b/libraries/classes/Theme.php index f8e67d0714..3a113e2290 100644 --- a/libraries/classes/Theme.php +++ b/libraries/classes/Theme.php @@ -125,7 +125,11 @@ class Theme return false; } // Check that all required data are there - $members = ['name', 'version', 'supports']; + $members = [ + 'name', + 'version', + 'supports', + ]; foreach ($members as $member) { if (! isset($data[$member])) { return false; diff --git a/libraries/classes/Tracker.php b/libraries/classes/Tracker.php index accbaa443e..ddceb176b9 100644 --- a/libraries/classes/Tracker.php +++ b/libraries/classes/Tracker.php @@ -230,7 +230,10 @@ class Tracker $indexes = $GLOBALS['dbi']->getTableIndexes($dbname, $tablename); - $snapshot = ['COLUMNS' => $columns, 'INDEXES' => $indexes]; + $snapshot = [ + 'COLUMNS' => $columns, + 'INDEXES' => $indexes, + ]; $snapshot = serialize($snapshot); // Get DROP TABLE / DROP VIEW and CREATE TABLE SQL statements @@ -594,7 +597,7 @@ class Tracker $ddlog[] = [ 'date' => $date, 'username' => $username, - 'statement' => $statement + 'statement' => $statement, ]; } } @@ -626,7 +629,7 @@ class Tracker $dmlog[] = [ 'date' => $date, 'username' => $username, - 'statement' => $statement + 'statement' => $statement, ]; } } diff --git a/libraries/classes/Tracking.php b/libraries/classes/Tracking.php index fd2df8abe6..45342f9f29 100644 --- a/libraries/classes/Tracking.php +++ b/libraries/classes/Tracking.php @@ -75,7 +75,7 @@ class Tracking 'id' => $id, 'timestamp' => $timestamp, 'username' => $entry['username'], - 'statement' => $entry['statement'] + 'statement' => $entry['statement'], ]; } $id++; @@ -371,7 +371,13 @@ class Tracking . htmlspecialchars($_POST['users']) . '">'; $str5 = '<input type="hidden" name="list_report" value="1">' . '<input class="btn btn-primary" type="submit" value="' . __('Go') . '">'; - return [$str1, $str2, $str3, $str4, $str5]; + return [ + $str1, + $str2, + $str3, + $str4, + $str5, + ]; } /** @@ -595,7 +601,10 @@ class Tracking 'ddl_versions' ); - return [$html, $line_number]; + return [ + $html, + $line_number, + ]; } /** @@ -655,7 +664,10 @@ class Tracking 'drop_image_or_text' => $dropImageOrText, ]); - return [$html, $lineNumber]; + return [ + $html, + $lineNumber, + ]; } /** @@ -696,7 +708,10 @@ class Tracking // Unserialize snapshot $temp = Core::safeUnserialize($data['schema_snapshot']); if ($temp === null) { - $temp = ['COLUMNS' => [], 'INDEXES' => []]; + $temp = [ + 'COLUMNS' => [], + 'INDEXES' => [], + ]; } $columns = $temp['COLUMNS']; $indexes = $temp['INDEXES']; @@ -1284,13 +1299,13 @@ class Tracking 0 => [ 'label' => __('not active'), 'value' => 'deactivate_now', - 'selected' => ($state != 'active') + 'selected' => ($state != 'active'), ], 1 => [ 'label' => __('active'), 'value' => 'activate_now', - 'selected' => ($state == 'active') - ] + 'selected' => ($state == 'active'), + ], ]; $link = 'tbl_tracking.php' . $urlQuery . '&table=' . htmlspecialchars($versionData['table_name']) diff --git a/libraries/classes/Transformations.php b/libraries/classes/Transformations.php index 1921b9538b..7036d61e09 100644 --- a/libraries/classes/Transformations.php +++ b/libraries/classes/Transformations.php @@ -229,8 +229,14 @@ class Transformations public function fixUpMime($value) { $value = str_replace( - ["jpeg", "png"], - ["JPEG", "PNG"], + [ + "jpeg", + "png", + ], + [ + "JPEG", + "PNG", + ], $value ); return str_replace( diff --git a/libraries/classes/Twig/RelationExtension.php b/libraries/classes/Twig/RelationExtension.php index de8bf4a684..6aca5d30bc 100644 --- a/libraries/classes/Twig/RelationExtension.php +++ b/libraries/classes/Twig/RelationExtension.php @@ -31,25 +31,40 @@ class RelationExtension extends AbstractExtension return [ new TwigFunction( 'foreign_dropdown', - [$relation, 'foreignDropdown'], + [ + $relation, + 'foreignDropdown', + ], ['is_safe' => ['html']] ), new TwigFunction( 'get_display_field', - [$relation, 'getDisplayField'], + [ + $relation, + 'getDisplayField', + ], ['is_safe' => ['html']] ), new TwigFunction( 'get_foreign_data', - [$relation, 'getForeignData'] + [ + $relation, + 'getForeignData', + ] ), new TwigFunction( 'get_tables', - [$relation, 'getTables'] + [ + $relation, + 'getTables', + ] ), new TwigFunction( 'search_column_in_foreigners', - [$relation, 'searchColumnInForeigners'] + [ + $relation, + 'searchColumnInForeigners', + ] ), ]; } diff --git a/libraries/classes/Twig/ServerPrivilegesExtension.php b/libraries/classes/Twig/ServerPrivilegesExtension.php index 9bb16ee2b0..0a1363cd93 100644 --- a/libraries/classes/Twig/ServerPrivilegesExtension.php +++ b/libraries/classes/Twig/ServerPrivilegesExtension.php @@ -40,7 +40,10 @@ class ServerPrivilegesExtension extends AbstractExtension return [ new TwigFunction( 'format_privilege', - [$serverPrivileges, 'formatPrivilege'], + [ + $serverPrivileges, + 'formatPrivilege', + ], ['is_safe' => ['html']] ), ]; diff --git a/libraries/classes/Twig/TransformationsExtension.php b/libraries/classes/Twig/TransformationsExtension.php index 98f75cb310..5ab9ef570f 100644 --- a/libraries/classes/Twig/TransformationsExtension.php +++ b/libraries/classes/Twig/TransformationsExtension.php @@ -31,11 +31,17 @@ class TransformationsExtension extends AbstractExtension return [ new TwigFunction( 'get_description', - [$transformations, 'getDescription'] + [ + $transformations, + 'getDescription', + ] ), new TwigFunction( 'get_name', - [$transformations, 'getName'] + [ + $transformations, + 'getName', + ] ), ]; } diff --git a/libraries/classes/TwoFactor.php b/libraries/classes/TwoFactor.php index f0654833d1..a5f84dcb4f 100644 --- a/libraries/classes/TwoFactor.php +++ b/libraries/classes/TwoFactor.php @@ -246,7 +246,7 @@ class TwoFactor public function configure($name) { $this->config = [ - 'backend' => $name + 'backend' => $name, ]; if ($name === '') { $cls = $this->getBackendClass($name); diff --git a/libraries/classes/Types.php b/libraries/classes/Types.php index 7f2abc4fa6..b98ccaa9da 100644 --- a/libraries/classes/Types.php +++ b/libraries/classes/Types.php @@ -774,7 +774,13 @@ class Types */ public function getIntegerTypes() { - return ['tinyint', 'smallint', 'mediumint', 'int', 'bigint']; + return [ + 'tinyint', + 'smallint', + 'mediumint', + 'int', + 'bigint', + ]; } /** @@ -789,23 +795,56 @@ class Types { static $min_max_data = [ 'unsigned' => [ - 'tinyint' => ['0', '255'], - 'smallint' => ['0', '65535'], - 'mediumint' => ['0', '16777215'], - 'int' => ['0', '4294967295'], - 'bigint' => ['0', '18446744073709551615'] + 'tinyint' => [ + '0', + '255', + ], + 'smallint' => [ + '0', + '65535', + ], + 'mediumint' => [ + '0', + '16777215', + ], + 'int' => [ + '0', + '4294967295', + ], + 'bigint' => [ + '0', + '18446744073709551615', + ], ], 'signed' => [ - 'tinyint' => ['-128', '127'], - 'smallint' => ['-32768', '32767'], - 'mediumint' => ['-8388608', '8388607'], - 'int' => ['-2147483648', '2147483647'], - 'bigint' => ['-9223372036854775808', '9223372036854775807'] + 'tinyint' => [ + '-128', + '127', + ], + 'smallint' => [ + '-32768', + '32767', + ], + 'mediumint' => [ + '-8388608', + '8388607', + ], + 'int' => [ + '-2147483648', + '2147483647', + ], + 'bigint' => [ + '-9223372036854775808', + '9223372036854775807', + ], ] ]; $relevantArray = $signed ? $min_max_data['signed'] : $min_max_data['unsigned']; - return isset($relevantArray[$type]) ? $relevantArray[$type] : ['', '']; + return isset($relevantArray[$type]) ? $relevantArray[$type] : [ + '', + '', + ]; } } diff --git a/libraries/classes/UserPassword.php b/libraries/classes/UserPassword.php index a6fb8b8c32..eb47a16e6e 100644 --- a/libraries/classes/UserPassword.php +++ b/libraries/classes/UserPassword.php @@ -92,7 +92,10 @@ class UserPassword $error = true; } } - return ['error' => $error, 'msg' => $message]; + return [ + 'error' => $error, + 'msg' => $message + ]; } /** diff --git a/libraries/classes/UserPreferences.php b/libraries/classes/UserPreferences.php index 23588e4ae3..192635895b 100644 --- a/libraries/classes/UserPreferences.php +++ b/libraries/classes/UserPreferences.php @@ -59,7 +59,7 @@ class UserPreferences $cf->setCfgUpdateReadMapping( [ 'Server/hide_db' => 'Servers/1/hide_db', - 'Server/only_db' => 'Servers/1/only_db' + 'Server/only_db' => 'Servers/1/only_db', ] ); $cf->updateWithGlobalConfig($GLOBALS['cfg']); @@ -83,7 +83,7 @@ class UserPreferences if (! isset($_SESSION['userconfig'])) { $_SESSION['userconfig'] = [ 'db' => [], - 'ts' => time() + 'ts' => time(), ]; } return [ @@ -127,7 +127,7 @@ class UserPreferences // no pmadb table, use session storage $_SESSION['userconfig'] = [ 'db' => $config_array, - 'ts' => time() + 'ts' => time(), ]; if (isset($_SESSION['cache'][$cache_key]['userprefs'])) { unset($_SESSION['cache'][$cache_key]['userprefs']); diff --git a/libraries/classes/Util.php b/libraries/classes/Util.php index 9ad576d6c7..c95c49b944 100644 --- a/libraries/classes/Util.php +++ b/libraries/classes/Util.php @@ -681,8 +681,14 @@ class Util // All non-single blanks and TAB-characters are replaced with their // HTML-counterpart $server_msg = str_replace( - [' ', "\t"], - [' ', ' '], + [ + ' ', + "\t", + ], + [ + ' ', + ' ', + ], $server_msg ); @@ -1325,7 +1331,7 @@ class Util /* l10n: shortcuts for Petabyte */ __('PiB'), /* l10n: shortcuts for Exabyte */ - __('EiB') + __('EiB'), ]; $dh = pow(10, $comma); @@ -1352,7 +1358,10 @@ class Util $return_value = self::formatNumber($value, 0); } - return [trim($return_value), $unit]; + return [ + trim($return_value), + $unit, + ]; } // end of the 'formatByteDown' function @@ -1554,7 +1563,7 @@ class Util /* l10n: Short month name */ __('Nov'), /* l10n: Short month name */ - __('Dec') + __('Dec'), ]; $day_of_week = [ /* l10n: Short week day name */ @@ -1570,7 +1579,7 @@ class Util /* l10n: Short week day name */ __('Fri'), /* l10n: Short week day name */ - __('Sat') + __('Sat'), ]; if ($format == '') { @@ -3536,7 +3545,7 @@ class Util 'multipoint', 'multilinestring', 'multipolygon', - 'geometrycollection' + 'geometrycollection', ]; if ($upper_case) { for ($i = 0, $nb = count($gis_data_types); $i < $nb; $i++) { @@ -3593,12 +3602,30 @@ class Util } // Unary functions common to all geometry types - $funcs['Dimension'] = ['params' => 1, 'type' => 'int']; - $funcs['Envelope'] = ['params' => 1, 'type' => 'Polygon']; - $funcs['GeometryType'] = ['params' => 1, 'type' => 'text']; - $funcs['SRID'] = ['params' => 1, 'type' => 'int']; - $funcs['IsEmpty'] = ['params' => 1, 'type' => 'int']; - $funcs['IsSimple'] = ['params' => 1, 'type' => 'int']; + $funcs['Dimension'] = [ + 'params' => 1, + 'type' => 'int' + ]; + $funcs['Envelope'] = [ + 'params' => 1, + 'type' => 'Polygon' + ]; + $funcs['GeometryType'] = [ + 'params' => 1, + 'type' => 'text' + ]; + $funcs['SRID'] = [ + 'params' => 1, + 'type' => 'int' + ]; + $funcs['IsEmpty'] = [ + 'params' => 1, + 'type' => 'int' + ]; + $funcs['IsSimple'] = [ + 'params' => 1, + 'type' => 'int' + ]; $geom_type = trim(mb_strtolower((string) $geom_type)); if ($display && $geom_type != 'geometry' && $geom_type != 'multipoint') { @@ -3607,28 +3634,73 @@ class Util // Unary functions that are specific to each geometry type if ($geom_type == 'point') { - $funcs['X'] = ['params' => 1, 'type' => 'float']; - $funcs['Y'] = ['params' => 1, 'type' => 'float']; + $funcs['X'] = [ + 'params' => 1, + 'type' => 'float' + ]; + $funcs['Y'] = [ + 'params' => 1, + 'type' => 'float' + ]; } elseif ($geom_type == 'linestring') { - $funcs['EndPoint'] = ['params' => 1, 'type' => 'point']; - $funcs['GLength'] = ['params' => 1, 'type' => 'float']; - $funcs['NumPoints'] = ['params' => 1, 'type' => 'int']; - $funcs['StartPoint'] = ['params' => 1, 'type' => 'point']; - $funcs['IsRing'] = ['params' => 1, 'type' => 'int']; + $funcs['EndPoint'] = [ + 'params' => 1, + 'type' => 'point' + ]; + $funcs['GLength'] = [ + 'params' => 1, + 'type' => 'float' + ]; + $funcs['NumPoints'] = [ + 'params' => 1, + 'type' => 'int' + ]; + $funcs['StartPoint'] = [ + 'params' => 1, + 'type' => 'point' + ]; + $funcs['IsRing'] = [ + 'params' => 1, + 'type' => 'int' + ]; } elseif ($geom_type == 'multilinestring') { - $funcs['GLength'] = ['params' => 1, 'type' => 'float']; - $funcs['IsClosed'] = ['params' => 1, 'type' => 'int']; + $funcs['GLength'] = [ + 'params' => 1, + 'type' => 'float' + ]; + $funcs['IsClosed'] = [ + 'params' => 1, + 'type' => 'int' + ]; } elseif ($geom_type == 'polygon') { - $funcs['Area'] = ['params' => 1, 'type' => 'float']; - $funcs['ExteriorRing'] = ['params' => 1, 'type' => 'linestring']; - $funcs['NumInteriorRings'] = ['params' => 1, 'type' => 'int']; + $funcs['Area'] = [ + 'params' => 1, + 'type' => 'float' + ]; + $funcs['ExteriorRing'] = [ + 'params' => 1, + 'type' => 'linestring' + ]; + $funcs['NumInteriorRings'] = [ + 'params' => 1, + 'type' => 'int' + ]; } elseif ($geom_type == 'multipolygon') { - $funcs['Area'] = ['params' => 1, 'type' => 'float']; - $funcs['Centroid'] = ['params' => 1, 'type' => 'point']; + $funcs['Area'] = [ + 'params' => 1, + 'type' => 'float' + ]; + $funcs['Centroid'] = [ + 'params' => 1, + 'type' => 'point' + ]; // Not yet implemented in MySQL //$funcs['PointOnSurface'] = array('params' => 1, 'type' => 'point'); } elseif ($geom_type == 'geometrycollection') { - $funcs['NumGeometries'] = ['params' => 1, 'type' => 'int']; + $funcs['NumGeometries'] = [ + 'params' => 1, + 'type' => 'int' + ]; } // If we are asked for binary functions as well @@ -3639,38 +3711,107 @@ class Util } if ($GLOBALS['dbi']->getVersion() < 50601) { - $funcs['Crosses'] = ['params' => 2, 'type' => 'int']; - $funcs['Contains'] = ['params' => 2, 'type' => 'int']; - $funcs['Disjoint'] = ['params' => 2, 'type' => 'int']; - $funcs['Equals'] = ['params' => 2, 'type' => 'int']; - $funcs['Intersects'] = ['params' => 2, 'type' => 'int']; - $funcs['Overlaps'] = ['params' => 2, 'type' => 'int']; - $funcs['Touches'] = ['params' => 2, 'type' => 'int']; - $funcs['Within'] = ['params' => 2, 'type' => 'int']; + $funcs['Crosses'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Contains'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Disjoint'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Equals'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Intersects'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Overlaps'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Touches'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['Within'] = [ + 'params' => 2, + 'type' => 'int' + ]; } else { // If MySQl version is greater than or equal 5.6.1, // use the ST_ prefix. - $funcs['ST_Crosses'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Contains'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Disjoint'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Equals'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Intersects'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Overlaps'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Touches'] = ['params' => 2, 'type' => 'int']; - $funcs['ST_Within'] = ['params' => 2, 'type' => 'int']; + $funcs['ST_Crosses'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Contains'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Disjoint'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Equals'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Intersects'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Overlaps'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Touches'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['ST_Within'] = [ + 'params' => 2, + 'type' => 'int' + ]; } if ($display) { $funcs[] = ['display' => '--------']; } // Minimum bounding rectangle functions - $funcs['MBRContains'] = ['params' => 2, 'type' => 'int']; - $funcs['MBRDisjoint'] = ['params' => 2, 'type' => 'int']; - $funcs['MBREquals'] = ['params' => 2, 'type' => 'int']; - $funcs['MBRIntersects'] = ['params' => 2, 'type' => 'int']; - $funcs['MBROverlaps'] = ['params' => 2, 'type' => 'int']; - $funcs['MBRTouches'] = ['params' => 2, 'type' => 'int']; - $funcs['MBRWithin'] = ['params' => 2, 'type' => 'int']; + $funcs['MBRContains'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['MBRDisjoint'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['MBREquals'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['MBRIntersects'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['MBROverlaps'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['MBRTouches'] = [ + 'params' => 2, + 'type' => 'int' + ]; + $funcs['MBRWithin'] = [ + 'params' => 2, + 'type' => 'int' + ]; } return $funcs; } @@ -4057,7 +4198,7 @@ class Util 'vars' => __('Variables'), 'charset' => __('Charsets'), 'plugins' => __('Plugins'), - 'engine' => __('Engines') + 'engine' => __('Engines'), ], 'db' => [ 'structure' => __('Structure'), @@ -4073,7 +4214,7 @@ class Util 'triggers' => __('Triggers'), 'tracking' => __('Tracking'), 'designer' => __('Designer'), - 'central_columns' => __('Central columns') + 'central_columns' => __('Central columns'), ], 'table' => [ 'browse' => __('Browse'), @@ -4087,7 +4228,7 @@ class Util 'operation' => __('Operations'), 'tracking' => __('Tracking'), 'triggers' => __('Triggers'), - ] + ], ]; if ($level == null) { @@ -4272,7 +4413,12 @@ class Util } } // end while - return [$primary, $pk_array, $indexes_info, $indexes_data]; + return [ + $primary, + $pk_array, + $indexes_info, + $indexes_data, + ]; } /** @@ -4519,7 +4665,7 @@ class Util $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, - $pos + $pos, ]; } @@ -4659,7 +4805,10 @@ class Util { $result = ''; if (class_exists('phpseclib\\Crypt\\Random')) { - $random_func = ['phpseclib\\Crypt\\Random', 'string']; + $random_func = [ + 'phpseclib\\Crypt\\Random', + 'string', + ]; } else { $random_func = 'openssl_random_pseudo_bytes'; } @@ -4760,12 +4909,18 @@ class Util $orderImg = ' ' . self::getImage( 's_asc', __('Ascending'), - ['class' => 'sort_arrow', 'title' => ''] + [ + 'class' => 'sort_arrow', + 'title' => '', + ] ); $orderImg .= ' ' . self::getImage( 's_desc', __('Descending'), - ['class' => 'sort_arrow hide', 'title' => ''] + [ + 'class' => 'sort_arrow hide', + 'title' => '', + ] ); // but on mouse over, show the reverse order (DESC) $orderLinkParams['onmouseover'] = "$('.sort_arrow').toggle();"; @@ -4777,12 +4932,18 @@ class Util $orderImg = ' ' . self::getImage( 's_asc', __('Ascending'), - ['class' => 'sort_arrow hide', 'title' => ''] + [ + 'class' => 'sort_arrow hide', + 'title' => '', + ] ); $orderImg .= ' ' . self::getImage( 's_desc', __('Descending'), - ['class' => 'sort_arrow', 'title' => ''] + [ + 'class' => 'sort_arrow', + 'title' => '', + ] ); // but on mouse over, show the reverse order (ASC) $orderLinkParams['onmouseover'] = "$('.sort_arrow').toggle();"; diff --git a/libraries/classes/Utils/HttpRequest.php b/libraries/classes/Utils/HttpRequest.php index c86bf20b3c..6a1360ab04 100644 --- a/libraries/classes/Utils/HttpRequest.php +++ b/libraries/classes/Utils/HttpRequest.php @@ -45,7 +45,7 @@ class HttpRequest if (strlen($this->proxyUrl) > 0) { $context['http'] = [ 'proxy' => $this->proxyUrl, - 'request_fulluri' => true + 'request_fulluri' => true, ]; if (strlen($this->proxyUser) > 0) { $auth = base64_encode( @@ -210,7 +210,7 @@ class HttpRequest 'timeout' => 10, 'user_agent' => 'phpMyAdmin', 'header' => "Accept: */*", - ] + ], ]; if ($header) { $context['http']['header'] .= "\n" . $header; diff --git a/libraries/classes/VersionInformation.php b/libraries/classes/VersionInformation.php index 6b604da649..7b2a0d9e20 100644 --- a/libraries/classes/VersionInformation.php +++ b/libraries/classes/VersionInformation.php @@ -61,7 +61,7 @@ class VersionInformation if ($save) { $_SESSION['cache']['version_check'] = [ 'response' => $response, - 'timestamp' => time() + 'timestamp' => time(), ]; } return $data; @@ -185,7 +185,15 @@ class VersionInformation { $operator = null; $version = null; - $operators = ["<=", ">=", "!=", "<>", "<", ">", "="]; // preserve order + $operators = [ + "<=", + ">=", + "!=", + "<>", + "<", + ">", + "=", + ]; // preserve order foreach ($operators as $oneOperator) { if (strpos($condition, $oneOperator) === 0) { $operator = $oneOperator; diff --git a/libraries/common.inc.php b/libraries/common.inc.php index ded8d18e0b..3509bfa723 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -387,7 +387,10 @@ if (! defined('PMA_MINIMUM_COMMON')) { if ($GLOBALS['dbi']->getVersion() < $cfg['MysqlMinVersion']['internal']) { Core::fatalError( __('You should upgrade to %s %s or later.'), - ['MySQL', $cfg['MysqlMinVersion']['human']] + [ + 'MySQL', + $cfg['MysqlMinVersion']['human'], + ] ); } diff --git a/libraries/config.default.php b/libraries/config.default.php index 1a78a3158b..1e5ac38e94 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -1300,7 +1300,10 @@ $cfg['InsertRows'] = 2; * * @global array $cfg['ForeignKeyDropdownOrder'] */ -$cfg['ForeignKeyDropdownOrder'] = ['content-id', 'id-content']; +$cfg['ForeignKeyDropdownOrder'] = [ + 'content-id', + 'id-content', +]; /** * A drop-down list will be used if fewer items are present @@ -2526,7 +2529,13 @@ $cfg['Schema']['svg_all_tables_same_width'] = false; * * @global array $cfg['PDFPageSizes'] */ -$cfg['PDFPageSizes'] = ['A3', 'A4', 'A5', 'letter', 'legal']; +$cfg['PDFPageSizes'] = [ + 'A3', + 'A4', + 'A5', + 'letter', + 'legal', +]; /** * @@ -3184,28 +3193,43 @@ $cfg['DefaultTransformations'] = []; * * @global array $cfg['DefaultTransformations']['Substring'] */ -$cfg['DefaultTransformations']['Substring'] = [0, 'all', '…']; +$cfg['DefaultTransformations']['Substring'] = [ + 0, + 'all', + '…', +]; /** * Default transformations for Bool2Text * * @global array $cfg['DefaultTransformations']['Bool2Text'] */ -$cfg['DefaultTransformations']['Bool2Text'] = ['T', 'F']; +$cfg['DefaultTransformations']['Bool2Text'] = [ + 'T', + 'F', +]; /** * Default transformations for External * * @global array $cfg['DefaultTransformations']['External'] */ -$cfg['DefaultTransformations']['External'] = [0, '-f /dev/null -i -wrap -q', 1, 1]; +$cfg['DefaultTransformations']['External'] = [ + 0, + '-f /dev/null -i -wrap -q', + 1, + 1, +]; /** * Default transformations for PreApPend * * @global array $cfg['DefaultTransformations']['PreApPend'] */ -$cfg['DefaultTransformations']['PreApPend'] = ['', '']; +$cfg['DefaultTransformations']['PreApPend'] = [ + '', + '', +]; /** * Default transformations for Hex @@ -3219,14 +3243,21 @@ $cfg['DefaultTransformations']['Hex'] = ['2']; * * @global array $cfg['DefaultTransformations']['DateFormat'] */ -$cfg['DefaultTransformations']['DateFormat'] = [0, '', 'local']; +$cfg['DefaultTransformations']['DateFormat'] = [ + 0, + '', + 'local', +]; /** * Default transformations for Inline * * @global array $cfg['DefaultTransformations']['Inline'] */ -$cfg['DefaultTransformations']['Inline'] = ['100', 100]; +$cfg['DefaultTransformations']['Inline'] = [ + '100', + 100, +]; $cfg['DefaultTransformations']['Inline']['wrapper_link'] = null; /** @@ -3234,11 +3265,19 @@ $cfg['DefaultTransformations']['Inline']['wrapper_link'] = null; * * @global array $cfg['DefaultTransformations']['TextImageLink'] */ -$cfg['DefaultTransformations']['TextImageLink'] = [null, 100, 50]; +$cfg['DefaultTransformations']['TextImageLink'] = [ + null, + 100, + 50, +]; /** * Default transformations for TextLink * * @global array $cfg['DefaultTransformations']['TextLink'] */ -$cfg['DefaultTransformations']['TextLink'] = [null, null, null]; +$cfg['DefaultTransformations']['TextLink'] = [ + null, + null, + null, +]; diff --git a/libraries/config.values.php b/libraries/config.values.php index 1b06100e16..05fb879507 100644 --- a/libraries/config.values.php +++ b/libraries/config.values.php @@ -23,17 +23,40 @@ return [ 'Servers' => [ 1 => [ 'port' => 'integer', - 'auth_type' => ['config', 'http', 'signon', 'cookie'], + 'auth_type' => [ + 'config', + 'http', + 'signon', + 'cookie', + ], 'AllowDeny' => [ - 'order' => ['', 'deny,allow', 'allow,deny', 'explicit'], + 'order' => [ + '', + 'deny,allow', + 'allow,deny', + 'explicit', + ], ], 'only_db' => 'array', ], ], - 'RecodingEngine' => ['auto', 'iconv', 'recode', 'mb', 'none'], - 'OBGzip' => ['auto', true, false], + 'RecodingEngine' => [ + 'auto', + 'iconv', + 'recode', + 'mb', + 'none', + ], + 'OBGzip' => [ + 'auto', + true, + false, + ], 'MemoryLimit' => 'short_string', - 'NavigationLogoLinkWindow' => ['main', 'new'], + 'NavigationLogoLinkWindow' => [ + 'main', + 'new', + ], 'NavigationTreeDefaultTabTable' => [ // fields list 'structure' => __('Structure'), @@ -68,8 +91,18 @@ return [ 'text' => __('Text'), 'both' => __('Both'), ], - 'MaxRows' => [25, 50, 100, 250, 500], - 'Order' => ['ASC', 'DESC', 'SMART'], + 'MaxRows' => [ + 25, + 50, + 100, + 250, + 500, + ], + 'Order' => [ + 'ASC', + 'DESC', + 'SMART', + ], 'RowActionLinks' => [ 'none' => __('Nowhere'), 'left' => __('Left'), @@ -81,8 +114,16 @@ return [ 'ASC' => __('Ascending'), 'DESC' => __('Descending'), ], - 'ProtectBinary' => [false, 'blob', 'noblob', 'all'], - 'CharEditing' => ['input', 'textarea'], + 'ProtectBinary' => [ + false, + 'blob', + 'noblob', + 'all', + ], + 'CharEditing' => [ + 'input', + 'textarea', + ], 'TabsMode' => [ 'icons' => __('Icons'), 'text' => __('Text'), @@ -175,8 +216,14 @@ return [ $GLOBALS['cfg']['AvailableCharsets'] ), 'sql_compatibility' => [ - 'NONE', 'ANSI', 'DB2', 'MAXDB', 'MYSQL323', - 'MYSQL40', 'MSSQL', 'ORACLE', + 'NONE', + 'ANSI', + 'DB2', + 'MAXDB', + 'MYSQL323', + 'MYSQL40', + 'MSSQL', + 'ORACLE', // removed; in MySQL 5.0.33, this produces exports that // can't be read by POSTGRESQL (see our bug #1596328) //'POSTGRESQL', @@ -188,7 +235,11 @@ return [ 'ldi_terminated' => 'short_string', 'ldi_enclosed' => 'short_string', 'ldi_escaped' => 'short_string', - 'ldi_local_option' => ['auto', true, false], + 'ldi_local_option' => [ + 'auto', + true, + false, + ], ], 'Export' => [ @@ -205,24 +256,47 @@ return [ ), ], 'format' => [ - 'codegen', 'csv', 'excel', 'htmlexcel', 'htmlword', 'latex', 'ods', - 'odt', 'pdf', 'sql', 'texytext', 'xml', 'yaml', + 'codegen', + 'csv', + 'excel', + 'htmlexcel', + 'htmlword', + 'latex', + 'ods', + 'odt', + 'pdf', + 'sql', + 'texytext', + 'xml', + 'yaml', + ], + 'compression' => [ + 'none', + 'zip', + 'gzip', ], - 'compression' => ['none', 'zip', 'gzip'], 'charset' => array_merge( [''], $GLOBALS['cfg']['AvailableCharsets'] ), 'sql_compatibility' => [ - 'NONE', 'ANSI', 'DB2', 'MAXDB', 'MYSQL323', - 'MYSQL40', 'MSSQL', 'ORACLE', + 'NONE', + 'ANSI', + 'DB2', + 'MAXDB', + 'MYSQL323', + 'MYSQL40', + 'MSSQL', + 'ORACLE', // removed; in MySQL 5.0.33, this produces exports that // can't be read by POSTGRESQL (see our bug #1596328) //'POSTGRESQL', 'TRADITIONAL', ], 'codegen_format' => [ - '#', 'NHibernate C# DO', 'NHibernate XML', + '#', + 'NHibernate C# DO', + 'NHibernate XML', ], 'csv_separator' => 'short_string', 'csv_terminated' => 'short_string', @@ -240,7 +314,11 @@ return [ 'data' => __('data'), 'structure_and_data' => __('structure and data'), ], - 'sql_type' => ['INSERT', 'UPDATE', 'REPLACE'], + 'sql_type' => [ + 'INSERT', + 'UPDATE', + 'REPLACE', + ], 'sql_insert_syntax' => [ 'complete' => __('complete inserts'), 'extended' => __('extended inserts'), @@ -269,10 +347,21 @@ return [ ], 'Console' => [ - 'Mode' => ['info', 'show', 'collapse'], + 'Mode' => [ + 'info', + 'show', + 'collapse', + ], 'Height' => 'integer', - 'OrderBy' => ['exec', 'time', 'count'], - 'Order' => ['asc', 'desc'], + 'OrderBy' => [ + 'exec', + 'time', + 'count', + ], + 'Order' => [ + 'asc', + 'desc', + ], ], /** @@ -293,12 +382,42 @@ return [ 'Export/sql_max_query_size' => 'validatePositiveNumber', 'FirstLevelNavigationItems' => 'validatePositiveNumber', 'ForeignKeyMaxLimit' => 'validatePositiveNumber', - 'Import/csv_enclosed' => [['validateByRegex', '/^.?$/']], - 'Import/csv_escaped' => [['validateByRegex', '/^.$/']], - 'Import/csv_terminated' => [['validateByRegex', '/^.$/']], - 'Import/ldi_enclosed' => [['validateByRegex', '/^.?$/']], - 'Import/ldi_escaped' => [['validateByRegex', '/^.$/']], - 'Import/ldi_terminated' => [['validateByRegex', '/^.$/']], + 'Import/csv_enclosed' => [ + [ + 'validateByRegex', + '/^.?$/', + ], + ], + 'Import/csv_escaped' => [ + [ + 'validateByRegex', + '/^.$/', + ], + ], + 'Import/csv_terminated' => [ + [ + 'validateByRegex', + '/^.$/', + ], + ], + 'Import/ldi_enclosed' => [ + [ + 'validateByRegex', + '/^.?$/', + ], + ], + 'Import/ldi_escaped' => [ + [ + 'validateByRegex', + '/^.$/', + ], + ], + 'Import/ldi_terminated' => [ + [ + 'validateByRegex', + '/^.$/', + ], + ], 'Import/skip_queries' => 'validateNonNegativeNumber', 'InsertRows' => 'validatePositiveNumber', 'NumRecentTables' => 'validateNonNegativeNumber', @@ -311,7 +430,12 @@ return [ 'MaxCharactersInDisplayedSQL' => 'validatePositiveNumber', 'MaxRows' => 'validatePositiveNumber', 'MaxTableList' => 'validatePositiveNumber', - 'MemoryLimit' => [['validateByRegex', '/^(-1|(\d+(?:[kmg])?))$/i']], + 'MemoryLimit' => [ + [ + 'validateByRegex', + '/^(-1|(\d+(?:[kmg])?))$/i', + ], + ], 'NavigationTreeTableLevel' => 'validatePositiveNumber', 'NavigationWidth' => 'validateNonNegativeNumber', 'QueryHistoryMax' => 'validatePositiveNumber', @@ -330,13 +454,22 @@ return [ */ '_userValidators' => [ 'MaxDbList' => [ - ['validateUpperBound', 'value:MaxDbList'], + [ + 'validateUpperBound', + 'value:MaxDbList', + ], ], 'MaxTableList' => [ - ['validateUpperBound', 'value:MaxTableList'], + [ + 'validateUpperBound', + 'value:MaxTableList', + ], ], 'QueryHistoryMax' => [ - ['validateUpperBound', 'value:QueryHistoryMax'], + [ + 'validateUpperBound', + 'value:QueryHistoryMax', + ], ], ], ]; diff --git a/libraries/information_schema_relations.inc.php b/libraries/information_schema_relations.inc.php index 4011cfa644..1f8d6294e8 100644 --- a/libraries/information_schema_relations.inc.php +++ b/libraries/information_schema_relations.inc.php @@ -19,309 +19,309 @@ $GLOBALS['information_schema_relations'] = [ 'DEFAULT_COLLATE_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' - ] + 'foreign_field' => 'COLLATION_NAME', + ], ], 'COLLATIONS' => [ 'CHARACTER_SET_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' - ] + 'foreign_field' => 'CHARACTER_SET_NAME', + ], ], 'COLLATION_CHARACTER_SET_APPLICABILITY' => [ 'CHARACTER_SET_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'COLUMNS' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'CHARACTER_SET_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'COLUMN_PRIVILEGES' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'EVENTS' => [ 'EVENT_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'CHARACTER_SET_CLIENT' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_CONNECTION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'DATABASE_COLLATION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'FILES' => [ 'TABLESPACE_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'TABLESPACES', - 'foreign_field' => 'TABLESPACE_NAME' + 'foreign_field' => 'TABLESPACE_NAME', ], 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'COLLATION_CONNECTION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'ENGINE' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'ENGINES', - 'foreign_field' => 'ENGINE' + 'foreign_field' => 'ENGINE', ] ], 'KEY_COLUMN_USAGE' => [ 'CONSTRAINT_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'REFERENCED_TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'PARAMETERS' => [ 'SPECIFIC_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'CHARACTER_SET_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'PARTITIONS' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'TABLESPACE_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'TABLESPACES', - 'foreign_field' => 'TABLESPACE_NAME' - ] + 'foreign_field' => 'TABLESPACE_NAME', + ], ], 'PROCESSLIST' => [ 'DB' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'REFERENTIAL_CONSTRAINTS' => [ 'CONSTRAINT_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'UNIQUE_CONSTRAINT_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'ROUTINES' => [ 'ROUTINE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'CHARACTER_SET_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'CHARACTER_SET_CLIENT' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_CONNECTION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'DATABASE_COLLATION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'SCHEMATA' => [ 'DEFAULT_CHARACTER_SET_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'DEFAULT_COLLATION_NAME' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'SCHEMA_PRIVILEGES' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'STATISTICS' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'INDEX_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'TABLES' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'TABLE_COLLATION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'ENGINE' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'ENGINES', - 'foreign_field' => 'ENGINE' + 'foreign_field' => 'ENGINE', ], ], 'TABLESAPCES' => [ 'ENGINE' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'ENGINES', - 'foreign_field' => 'ENGINE' - ] + 'foreign_field' => 'ENGINE', + ], ], 'TABLE_CONSTRAINTS' => [ 'CONSTRAINT_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ] ], 'TABLE_PRIVILEGES' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' - ] + 'foreign_field' => 'SCHEMA_NAME', + ], ], 'TRIGGERS' => [ 'TRIGGER_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'EVENT_OBJECT_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'CHARACTER_SET_CLIENT' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_CONNECTION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'DATABASE_COLLATION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ] ], 'VIEWS' => [ 'TABLE_SCHEMA' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'CHARACTER_SET_CLIENT' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'COLLATION_CONNECTION' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' - ] + 'foreign_field' => 'COLLATION_NAME', + ], ] ]; diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index b82126affb..007b190467 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -34,7 +34,7 @@ $request_params = [ 'submit_mult', 'table_type', 'to_prefix', - 'url_query' + 'url_query', ]; foreach ($request_params as $one_request_param) { diff --git a/libraries/mysql_relations.inc.php b/libraries/mysql_relations.inc.php index 908f387f87..c58e7150b7 100644 --- a/libraries/mysql_relations.inc.php +++ b/libraries/mysql_relations.inc.php @@ -19,152 +19,152 @@ $GLOBALS['mysql_relations'] = [ 'Db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'db' => [ 'Db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'event' => [ 'db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'character_set_client' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'collation_connection' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'db_collation' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], ], 'help_category' => [ 'parent_category_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'help_category', - 'foreign_field' => 'help_category_id' + 'foreign_field' => 'help_category_id', ], ], 'help_relation' => [ 'help_topic_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'help_topic', - 'foreign_field' => 'help_topic_id' + 'foreign_field' => 'help_topic_id', ], 'help_keyword_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'help_keyword', - 'foreign_field' => 'help_keyword_id' + 'foreign_field' => 'help_keyword_id', ], ], 'help_topic' => [ 'help_category_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'help_category', - 'foreign_field' => 'help_category_id' + 'foreign_field' => 'help_category_id', ], ], 'innodb_index_stats' => [ 'database_name' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'innodb_table_stats' => [ 'database_name' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'proc' => [ 'db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], 'character_set_client' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'CHARACTER_SETS', - 'foreign_field' => 'CHARACTER_SET_NAME' + 'foreign_field' => 'CHARACTER_SET_NAME', ], 'collation_connection' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], 'db_collation' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'COLLATIONS', - 'foreign_field' => 'COLLATION_NAME' + 'foreign_field' => 'COLLATION_NAME', ], ], 'proc_priv' => [ 'Db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'servers' => [ 'Db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'slow_log' => [ 'db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'tables_priv' => [ 'Db' => [ 'foreign_db' => 'information_schema', 'foreign_table' => 'SCHEMATA', - 'foreign_field' => 'SCHEMA_NAME' + 'foreign_field' => 'SCHEMA_NAME', ], ], 'time_zone_name' => [ 'Time_zone_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'time_zone', - 'foreign_field' => 'Time_zone_id' + 'foreign_field' => 'Time_zone_id', ], ], 'time_zone_transition' => [ 'Time_zone_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'time_zone', - 'foreign_field' => 'Time_zone_id' + 'foreign_field' => 'Time_zone_id', ], 'Transition_time' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'time_zone_leap_second', - 'foreign_field' => 'Transition_time' - ] + 'foreign_field' => 'Transition_time', + ], ], 'time_zone_transition_type' => [ 'Time_zone_id' => [ 'foreign_db' => 'mysql', 'foreign_table' => 'time_zone', - 'foreign_field' => 'Time_zone_id' + 'foreign_field' => 'Time_zone_id', ], ], ]; diff --git a/libraries/replication.inc.php b/libraries/replication.inc.php index 98d6df0cb8..da90fbd874 100644 --- a/libraries/replication.inc.php +++ b/libraries/replication.inc.php @@ -49,7 +49,10 @@ $server_slave_replication = $GLOBALS['dbi']->fetchResult('SHOW SLAVE STATUS'); /** * replication types */ -$replication_types = ['master', 'slave']; +$replication_types = [ + 'master', + 'slave', +]; /** diff --git a/libraries/rte/rte_main.inc.php b/libraries/rte/rte_main.inc.php index d98444d94f..c65c5d4b89 100644 --- a/libraries/rte/rte_main.inc.php +++ b/libraries/rte/rte_main.inc.php @@ -56,7 +56,8 @@ if (! $response->isAjax()) { if (! isset($url_query)) { $url_query = Url::getCommon( [ - 'db' => $db, 'table' => $table + 'db' => $db, + 'table' => $table, ] ); } diff --git a/libraries/special_schema_links.inc.php b/libraries/special_schema_links.inc.php index 8c4ec758f0..4c24e17c5b 100644 --- a/libraries/special_schema_links.inc.php +++ b/libraries/special_schema_links.inc.php @@ -54,8 +54,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'host' - ] + 'column_name' => 'host', + ], ], 'default_page' => './server_privileges.php' ], @@ -64,7 +64,7 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'Db' + 'column_name' => 'Db', ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( @@ -77,12 +77,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'Db' + 'column_name' => 'Db', ], 1 => [ 'param_info' => 'table', - 'column_name' => 'Table_name' - ] + 'column_name' => 'Table_name', + ], ], 'default_page' => './tbl_structure.php?change_column=1' ], @@ -93,11 +93,11 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'host' - ] + 'column_name' => 'host', + ], ], 'default_page' => './server_privileges.php' - ] + ], ], 'event' => [ 'name' => [ @@ -105,8 +105,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'db' - ] + 'column_name' => 'db', + ], ], 'default_page' => './db_events.php?edit_item=1' ], @@ -118,7 +118,7 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'database_name' + 'column_name' => 'database_name', ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( @@ -131,12 +131,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'database_name' + 'column_name' => 'database_name', ], 1 => [ 'param_info' => 'table', - 'column_name' => 'table_name' - ] + 'column_name' => 'table_name', + ], ], 'default_page' => './tbl_structure.php' ], @@ -147,7 +147,7 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'database_name' + 'column_name' => 'database_name', ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( @@ -162,12 +162,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'db' + 'column_name' => 'db', ], 1 => [ 'param_info' => 'item_type', - 'column_name' => 'type' - ] + 'column_name' => 'type', + ], ], 'default_page' => './db_routines.php?edit_item=1' ], @@ -176,12 +176,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'db' + 'column_name' => 'db', ], 1 => [ 'param_info' => 'item_type', - 'column_name' => 'type' - ] + 'column_name' => 'type', + ], ], 'default_page' => './db_routines.php?edit_item=1' ], @@ -192,8 +192,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'Host' - ] + 'column_name' => 'Host', + ], ], 'default_page' => './server_privileges.php' ], @@ -202,12 +202,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'Db' + 'column_name' => 'Db', ], 1 => [ 'param_info' => 'item_type', - 'column_name' => 'Routine_type' - ] + 'column_name' => 'Routine_type', + ], ], 'default_page' => './db_routines.php?edit_item=1' ], @@ -218,8 +218,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'Host' - ] + 'column_name' => 'Host', + ], ], 'default_page' => './server_privileges.php' ], @@ -230,8 +230,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'Host' - ] + 'column_name' => 'Host', + ], ], 'default_page' => './server_privileges.php' ], @@ -240,7 +240,7 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'Db' + 'column_name' => 'Db', ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( @@ -255,11 +255,11 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'host' - ] + 'column_name' => 'host', + ], ], 'default_page' => './server_privileges.php' - ] + ], ] ], 'information_schema' => [ @@ -269,8 +269,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' - ] + 'column_name' => 'table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -282,15 +282,15 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' + 'column_name' => 'table_schema', ], 1 => [ 'param_info' => 'table', - 'column_name' => 'table_name' - ] + 'column_name' => 'table_name', + ], ], 'default_page' => './tbl_structure.php?change_column=1' - ] + ], ], 'key_column_usage' => [ 'table_name' => [ @@ -298,8 +298,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'constraint_schema' - ] + 'column_name' => 'constraint_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -311,12 +311,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' + 'column_name' => 'table_schema', ], 1 => [ 'param_info' => 'table', - 'column_name' => 'table_name' - ] + 'column_name' => 'table_name', + ], ], 'default_page' => './tbl_structure.php?change_column=1' ], @@ -325,8 +325,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'referenced_table_schema' - ] + 'column_name' => 'referenced_table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -338,15 +338,15 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'referenced_table_schema' + 'column_name' => 'referenced_table_schema', ], 1 => [ 'param_info' => 'table', - 'column_name' => 'referenced_table_name' - ] + 'column_name' => 'referenced_table_name', + ], ], 'default_page' => './tbl_structure.php?change_column=1' - ] + ], ], 'partitions' => [ 'table_name' => [ @@ -354,14 +354,14 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' - ] + 'column_name' => 'table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], 'table' ) - ] + ], ], 'processlist' => [ 'user' => [ @@ -369,11 +369,11 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'hostname', - 'column_name' => 'host' - ] + 'column_name' => 'host', + ], ], 'default_page' => './server_privileges.php' - ] + ], ], 'referential_constraints' => [ 'table_name' => [ @@ -381,8 +381,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'constraint_schema' - ] + 'column_name' => 'constraint_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -394,14 +394,14 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'constraint_schema' - ] + 'column_name' => 'constraint_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], 'table' ) - ] + ], ], 'routines' => [ 'routine_name' => [ @@ -409,12 +409,12 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'routine_schema' + 'column_name' => 'routine_schema', ], 1 => [ 'param_info' => 'item_type', - 'column_name' => 'routine_type' - ] + 'column_name' => 'routine_type', + ], ], 'default_page' => './db_routines.php' ], @@ -425,8 +425,8 @@ $GLOBALS['special_schema_links'] = [ 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], 'table' - ) - ] + ), + ], ], 'statistics' => [ 'table_name' => [ @@ -434,8 +434,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' - ] + 'column_name' => 'table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -447,15 +447,15 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' + 'column_name' => 'table_schema', ], 1 => [ 'param_info' => 'table', - 'column_name' => 'table_name' - ] + 'column_name' => 'table_name', + ], ], 'default_page' => './tbl_structure.php?change_column=1' - ] + ], ], 'tables' => [ 'table_name' => [ @@ -463,8 +463,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' - ] + 'column_name' => 'table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -478,8 +478,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' - ] + 'column_name' => 'table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -493,8 +493,8 @@ $GLOBALS['special_schema_links'] = [ 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' - ] + 'column_name' => 'table_schema', + ], ], 'default_page' => './' . PhpMyAdmin\Util::getScriptNameForOption( $GLOBALS['cfg']['DefaultTabTable'], @@ -502,5 +502,5 @@ $GLOBALS['special_schema_links'] = [ ) ], ], - ] + ], ]; diff --git a/libraries/tbl_columns_definition_form.inc.php b/libraries/tbl_columns_definition_form.inc.php index 3c359d6aa4..5d3d86a123 100644 --- a/libraries/tbl_columns_definition_form.inc.php +++ b/libraries/tbl_columns_definition_form.inc.php @@ -25,7 +25,13 @@ if (! defined('PHPMYADMIN')) { * Check parameters */ Util::checkParameters( - ['server', 'db', 'table', 'action', 'num_fields'] + [ + 'server', + 'db', + 'table', + 'action', + 'num_fields', + ] ); global $db, $table; @@ -54,7 +60,7 @@ $content_cells = []; /** @var string $db */ $form_params = [ - 'db' => $db + 'db' => $db, ]; if ($action == 'tbl_create.php') { @@ -64,7 +70,7 @@ if ($action == 'tbl_create.php') { $form_params = array_merge( $form_params, [ - 'field_where' => Util::getValueByKey($_POST, 'field_where') + 'field_where' => Util::getValueByKey($_POST, 'field_where'), ] ); if (isset($_POST['field_where'])) { @@ -112,7 +118,10 @@ if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) { } // this will be used on templates/columns_definitions/transformation.twig -$mime_types = ['input_transformation', 'transformation']; +$mime_types = [ + 'input_transformation', + 'transformation', +]; foreach ($mime_types as $mime_type) { if (isset($available_mime[$mime_type]) and is_iterable($available_mime[$mime_type])) { foreach ($available_mime[$mime_type] as $mimekey => $transform) { @@ -273,7 +282,10 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) { } elseif (isset($fields_meta[$columnNumber])) { $columnMeta = $fields_meta[$columnNumber]; $virtual = [ - 'VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED' + 'VIRTUAL', + 'PERSISTENT', + 'VIRTUAL GENERATED', + 'STORED GENERATED', ]; if (in_array($columnMeta['Extra'], $virtual)) { $tableObj = new Table($GLOBALS['table'], $GLOBALS['db']); @@ -507,7 +519,7 @@ $response = Response::getInstance(); $response->getHeader()->getScripts()->addFiles( [ 'vendor/jquery/jquery.uitablefilter.js', - 'indexes.js' + 'indexes.js', ] ); $response->addHTML($html); diff --git a/libraries/tbl_partition_definition.inc.php b/libraries/tbl_partition_definition.inc.php index 1c67677b27..57daff00b6 100644 --- a/libraries/tbl_partition_definition.inc.php +++ b/libraries/tbl_partition_definition.inc.php @@ -14,8 +14,10 @@ if (! isset($partitionDetails)) { // Extract some partitioning and subpartitioning parameters from the request $partitionParams = [ - 'partition_by', 'partition_expr', - 'subpartition_by', 'subpartition_expr', + 'partition_by', + 'partition_expr', + 'subpartition_by', + 'subpartition_expr', ]; foreach ($partitionParams as $partitionParam) { $partitionDetails[$partitionParam] = isset($_POST[$partitionParam]) diff --git a/libraries/user_preferences.inc.php b/libraries/user_preferences.inc.php index cfaba605a8..921506c423 100644 --- a/libraries/user_preferences.inc.php +++ b/libraries/user_preferences.inc.php @@ -33,12 +33,12 @@ $tabs_icons = [ $content = Util::getHtmlTab([ 'link' => 'prefs_manage.php', - 'text' => __('Manage your settings') + 'text' => __('Manage your settings'), ]) . "\n"; /* Second authentication factor */ $content .= Util::getHtmlTab([ 'link' => 'prefs_twofactor.php', - 'text' => __('Two-factor authentication') + 'text' => __('Two-factor authentication'), ]) . "\n"; $script_name = basename($GLOBALS['PMA_PHP_SELF']); foreach (UserFormList::getAll() as $formset) { diff --git a/normalization.php b/normalization.php index 0cceec946c..437f4d0fdc 100644 --- a/normalization.php +++ b/normalization.php @@ -41,7 +41,10 @@ if (isset($_POST['splitColumn'])) { } if (isset($_POST['addNewPrimary'])) { $num_fields = 1; - $columnMeta = ['Field' => $table . "_id", 'Extra' => 'auto_increment']; + $columnMeta = [ + 'Field' => $table . "_id", + 'Extra' => 'auto_increment', + ]; $html = $normalization->getHtmlForCreateNewColumn( $num_fields, $db, diff --git a/server_privileges.php b/server_privileges.php index 898de3cd6a..40e482a52c 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -60,7 +60,7 @@ if ((isset($_GET['viewing_mode']) $post_patterns = [ '/_priv$/i', - '/^max_/i' + '/^max_/i', ]; Core::setPostAsGlobal($post_patterns); @@ -439,8 +439,14 @@ if (isset($_GET['adduser'])) { if (isset($dbname) && ! is_array($dbname)) { $url_dbname = urlencode( str_replace( - ['\_', '\%'], - ['_', '%'], + [ + '\_', + '\%', + ], + [ + '_', + '%', + ], $dbname ) ); diff --git a/setup/frames/index.inc.php b/setup/frames/index.inc.php index 1b35bff200..1ac3ed82cd 100644 --- a/setup/frames/index.inc.php +++ b/setup/frames/index.inc.php @@ -138,7 +138,7 @@ echo $formDisplayTemplate->displayFormTop( 'get', [ 'page' => 'servers', - 'mode' => 'add' + 'mode' => 'add', ] ); echo '<div class="form">'; @@ -208,7 +208,7 @@ echo '<table width="100%" cellspacing="0">'; $opts = [ 'doc' => $form_display->getDocLink('DefaultLang'), 'values' => [], - 'values_escaped' => true + 'values_escaped' => true, ]; foreach ($all_languages as $each_lang) { $opts['values'][$each_lang->getCode()] = $each_lang->getName(); @@ -227,7 +227,7 @@ echo $formDisplayTemplate->displayInput( $opts = [ 'doc' => $form_display->getDocLink('ServerDefault'), 'values' => [], - 'values_disabled' => [] + 'values_disabled' => [], ]; if ($cf->getServerCount() > 0) { $opts['values']['0'] = __('let the user choose'); @@ -260,7 +260,7 @@ $opts = [ 'unix' => 'UNIX / Linux (\n)', 'win' => 'Windows (\r\n)' ], - 'values_escaped' => true + 'values_escaped' => true, ]; $eol = Core::ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix')); echo $formDisplayTemplate->displayInput( diff --git a/setup/frames/menu.inc.php b/setup/frames/menu.inc.php index 55bf3c6c76..854d07c8f6 100644 --- a/setup/frames/menu.inc.php +++ b/setup/frames/menu.inc.php @@ -21,7 +21,10 @@ echo '<li><a href="index.php' , Url::getCommon() , '"' , ($formset_id === null ? ' class="active' : '') , '">' , __('Overview') , '</a></li>'; -$ignored = ['Config', 'Servers']; +$ignored = [ + 'Config', + 'Servers', +]; foreach (SetupFormList::getAll() as $formset) { if (in_array($formset, $ignored)) { continue; diff --git a/setup/lib/Index.php b/setup/lib/Index.php index 57843370bf..21177506de 100644 --- a/setup/lib/Index.php +++ b/setup/lib/Index.php @@ -29,7 +29,10 @@ class Index public static function messagesBegin() { if (! isset($_SESSION['messages']) || ! is_array($_SESSION['messages'])) { - $_SESSION['messages'] = ['error' => [], 'notice' => []]; + $_SESSION['messages'] = [ + 'error' => [], + 'notice' => [], + ]; } else { // reset message states foreach ($_SESSION['messages'] as &$messages) { @@ -58,7 +61,7 @@ class Index 'fresh' => $fresh, 'active' => true, 'title' => $title, - 'message' => $message + 'message' => $message, ]; } diff --git a/setup/lib/common.inc.php b/setup/lib/common.inc.php index 1d6f5202a6..9d9a3c2791 100644 --- a/setup/lib/common.inc.php +++ b/setup/lib/common.inc.php @@ -43,7 +43,7 @@ $GLOBALS['ConfigFile']->setPersistKeys( 'Servers/1/socket', 'Servers/1/auth_type', 'Servers/1/user', - 'Servers/1/password' + 'Servers/1/password', ] ); @@ -200,7 +200,7 @@ if ($goto == 'sql.php') { [ 'db' => $db, 'table' => $table, - 'sql_query' => $sql_query + 'sql_query' => $sql_query, ] ); } // end if diff --git a/tbl_addfield.php b/tbl_addfield.php index 7c298e263e..60a23d938d 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -38,7 +38,8 @@ $transformations = new Transformations(); */ $err_url = 'tbl_sql.php' . Url::getCommon( [ - 'db' => $db, 'table' => $table + 'db' => $db, + 'table' => $table, ] ); diff --git a/tbl_change.php b/tbl_change.php index 4104331b79..d64abe9a33 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -140,7 +140,12 @@ $has_blob_field = false; foreach ($table_columns as $column) { if ($insertEdit->isColumn( $column, - ['blob', 'tinyblob', 'mediumblob', 'longblob'] + [ + 'blob', + 'tinyblob', + 'mediumblob', + 'longblob', + ] )) { $has_blob_field = true; break; diff --git a/tbl_export.php b/tbl_export.php index 5d30a41e02..68c7c47dc6 100644 --- a/tbl_export.php +++ b/tbl_export.php @@ -78,7 +78,8 @@ if (! empty($sql_query)) { ) { $replaces = [ [ - 'FROM', 'FROM ' . PhpMyAdmin\SqlParser\Components\ExpressionArray::build( + 'FROM', + 'FROM ' . PhpMyAdmin\SqlParser\Components\ExpressionArray::build( $parser->statements[0]->from ), ], @@ -88,12 +89,16 @@ if (! empty($sql_query)) { // Checking if the WHERE clause has to be replaced. if ((! empty($where_clause)) && (is_array($where_clause))) { $replaces[] = [ - 'WHERE', 'WHERE (' . implode(') OR (', $where_clause) . ')' + 'WHERE', + 'WHERE (' . implode(') OR (', $where_clause) . ')', ]; } // Preparing to remove the LIMIT clause. - $replaces[] = ['LIMIT', '']; + $replaces[] = [ + 'LIMIT', + '', + ]; // Replacing the clauses. $sql_query = PhpMyAdmin\SqlParser\Utils\Query::replaceClauses( @@ -114,11 +119,11 @@ if (! empty($sql_query)) { [ 'type' => PhpMyAdmin\SqlParser\Token::TYPE_OPERATOR, 'value_str' => '.', - ] + ], ], [ new PhpMyAdmin\SqlParser\Token($table), - new PhpMyAdmin\SqlParser\Token('.', PhpMyAdmin\SqlParser\Token::TYPE_OPERATOR) + new PhpMyAdmin\SqlParser\Token('.', PhpMyAdmin\SqlParser\Token::TYPE_OPERATOR), ] ); } diff --git a/tbl_get_field.php b/tbl_get_field.php index d8ff659e4f..614657b00d 100644 --- a/tbl_get_field.php +++ b/tbl_get_field.php @@ -27,7 +27,10 @@ $response->disable(); /* Check parameters */ PhpMyAdmin\Util::checkParameters( - ['db', 'table'] + [ + 'db', + 'table', + ] ); /* Select database */ diff --git a/tbl_gis_visualization.php b/tbl_gis_visualization.php index f5f70dc489..a2a99f059e 100644 --- a/tbl_gis_visualization.php +++ b/tbl_gis_visualization.php @@ -38,7 +38,7 @@ $dependency_definitions = [ 'database' ), "back" => 'sql.php', - "visualizationSettings" => [] + "visualizationSettings" => [], ]; /** @var TableGisVisualizationController $controller */ diff --git a/tbl_indexes.php b/tbl_indexes.php index 7c8b41f508..920538f040 100644 --- a/tbl_indexes.php +++ b/tbl_indexes.php @@ -47,7 +47,7 @@ if (isset($_POST['index'])) { } $dependency_definitions = [ - "index" => $index + "index" => $index, ]; /** @var TableIndexesController $controller */ diff --git a/tbl_replace.php b/tbl_replace.php index 9b0f54f7d8..1bbc5e2b43 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -61,7 +61,11 @@ $insertEdit = new InsertEdit($GLOBALS['dbi']); // check whether insert row mode, if so include tbl_change.php $insertEdit->isInsertRow(); -$after_insert_actions = ['new_insert', 'same_insert', 'edit_next']; +$after_insert_actions = [ + 'new_insert', + 'same_insert', + 'edit_next', +]; if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $after_insert_actions) ) { @@ -469,7 +473,7 @@ if ($response->isAjax() && ! isset($_POST['ajax_page_request'])) { } $transformation_types = [ "input_transformation", - "transformation" + "transformation", ]; foreach ($mime_map as $transformation) { $column_name = $transformation['column_name']; diff --git a/test/classes/AdvisorTest.php b/test/classes/AdvisorTest.php index 6f4a18220a..abd0497e48 100644 --- a/test/classes/AdvisorTest.php +++ b/test/classes/AdvisorTest.php @@ -57,10 +57,22 @@ class AdvisorTest extends PmaTestCase public function escapeStrings() { return [ - ['80%', '80%%'], - ['%s%', '%s%%'], - ['80% foo', '80%% foo'], - ['%s% foo', '%s%% foo'], + [ + '80%', + '80%%', + ], + [ + '%s%', + '%s%%', + ], + [ + '80% foo', + '80%% foo', + ], + [ + '%s% foo', + '%s%% foo', + ], ]; } @@ -98,11 +110,26 @@ class AdvisorTest extends PmaTestCase public function advisorTimes() { return [ - [10, "10 per second"], - [0.02, "1.2 per minute"], - [0.003, "10.8 per hour"], - [0.00003, "2.59 per day"], - [0.0000000003, "<0.01 per day"], + [ + 10, + "10 per second", + ], + [ + 0.02, + "1.2 per minute", + ], + [ + 0.003, + "10.8 per hour", + ], + [ + 0.00003, + "2.59 per day", + ], + [ + 0.0000000003, + "<0.01 per day", + ], ]; } @@ -161,14 +188,14 @@ class AdvisorTest extends PmaTestCase 'justification' => 'foo', 'name' => 'Basic', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], [ 'justification' => 'foo', 'id' => 'Basic', 'name' => 'Basic', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], null, ], @@ -177,7 +204,7 @@ class AdvisorTest extends PmaTestCase 'justification' => 'foo', 'name' => 'Variable', 'issue' => 'issue', - 'recommendation' => 'Recommend {status_var}' + 'recommendation' => 'Recommend {status_var}', ], [ 'justification' => 'foo', @@ -185,7 +212,7 @@ class AdvisorTest extends PmaTestCase 'name' => 'Variable', 'issue' => 'issue', 'recommendation' => 'Recommend <a href="server_variables.php?' . - 'filter=status_var&lang=en">status_var</a>' + 'filter=status_var&lang=en">status_var</a>', ], null, ], @@ -194,14 +221,14 @@ class AdvisorTest extends PmaTestCase 'justification' => '%s foo | value', 'name' => 'Format', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], [ 'justification' => '0 foo', 'id' => 'Format', 'name' => 'Format', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], null, ], @@ -210,14 +237,14 @@ class AdvisorTest extends PmaTestCase 'justification' => '%s% foo | value', 'name' => 'Percent', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], [ 'justification' => '0% foo', 'id' => 'Percent', 'name' => 'Percent', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], null, ], @@ -226,14 +253,14 @@ class AdvisorTest extends PmaTestCase 'justification' => '%s% %d foo | value, value', 'name' => 'Double', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], [ 'justification' => '0% 0 foo', 'id' => 'Double', 'name' => 'Double', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], null, ], @@ -242,14 +269,14 @@ class AdvisorTest extends PmaTestCase 'justification' => '"\'foo', 'name' => 'Quotes', 'issue' => 'issue', - 'recommendation' => 'Recommend"\'' + 'recommendation' => 'Recommend"\'', ], [ 'justification' => '"\'foo', 'id' => 'Quotes', 'name' => 'Quotes', 'issue' => 'issue', - 'recommendation' => 'Recommend"\'' + 'recommendation' => 'Recommend"\'', ], null, ], @@ -258,12 +285,12 @@ class AdvisorTest extends PmaTestCase 'justification' => 'foo | fsafdsa', 'name' => 'Failure', 'issue' => 'issue', - 'recommendation' => 'Recommend' + 'recommendation' => 'Recommend', ], [], 'Failed formatting string for rule \'Failure\'. ' . 'Error when evaluating: Variable "fsafdsa" is not ' . - 'valid around position 2 for expression `[fsafdsa]`.' + 'valid around position 2 for expression `[fsafdsa]`.', ], [ [ diff --git a/test/classes/BrowseForeignersTest.php b/test/classes/BrowseForeignersTest.php index b8c7edc7d1..6e4c94663e 100644 --- a/test/classes/BrowseForeignersTest.php +++ b/test/classes/BrowseForeignersTest.php @@ -165,7 +165,10 @@ class BrowseForeignersTest extends TestCase $desc = 'foobar<baz'; $this->assertEquals( - ['foobar<baz', ''], + [ + 'foobar<baz', + '', + ], $this->callProtectedMethod( 'getDescriptionAndTitle', [$desc] @@ -175,7 +178,10 @@ class BrowseForeignersTest extends TestCase $browseForeigners = new BrowseForeigners(5, 25, 100, false, ''); $this->assertEquals( - ['fooba...', 'foobar<baz'], + [ + 'fooba...', + 'foobar<baz', + ], $this->callProtectedMethod( 'getDescriptionAndTitle', [$desc], diff --git a/test/classes/CentralColumnsTest.php b/test/classes/CentralColumnsTest.php index 975b1c6ed7..cd48ee55af 100644 --- a/test/classes/CentralColumnsTest.php +++ b/test/classes/CentralColumnsTest.php @@ -31,39 +31,65 @@ class CentralColumnsTest extends TestCase private $columnData = [ [ - 'col_name' => "id", "col_type" => 'integer', - 'col_length' => 0, 'col_isNull' => 0, + 'col_name' => "id", + "col_type" => 'integer', + 'col_length' => 0, + 'col_isNull' => 0, 'col_extra' => 'UNSIGNED,auto_increment', - 'col_default' => 1, 'col_collation' => '' + 'col_default' => 1, + 'col_collation' => '', ], - ['col_name' => "col1", 'col_type' => 'varchar', - 'col_length' => 100, 'col_isNull' => 1, 'col_extra' => 'BINARY', - 'col_default' => 1, 'col_collation' => '' + [ + 'col_name' => "col1", + 'col_type' => 'varchar', + 'col_length' => 100, + 'col_isNull' => 1, + 'col_extra' => 'BINARY', + 'col_default' => 1, + 'col_collation' => '', ], [ - 'col_name' => "col2", 'col_type' => 'DATETIME', - 'col_length' => 0, 'col_isNull' => 1, + 'col_name' => "col2", + 'col_type' => 'DATETIME', + 'col_length' => 0, + 'col_isNull' => 1, 'col_extra' => 'on update CURRENT_TIMESTAMP', - 'col_default' => 'CURRENT_TIMESTAMP', 'col_collation' => '' - ] + 'col_default' => 'CURRENT_TIMESTAMP', + 'col_collation' => '', + ], ]; private $modifiedColumnData = [ [ - 'col_name' => "id", "col_type" => 'integer', - 'col_length' => 0, 'col_isNull' => 0, 'col_extra' => 'auto_increment', - 'col_default' => 1, 'col_collation' => '', 'col_attribute' => 'UNSIGNED' + 'col_name' => "id", + "col_type" => 'integer', + 'col_length' => 0, + 'col_isNull' => 0, + 'col_extra' => 'auto_increment', + 'col_default' => 1, + 'col_collation' => '', + 'col_attribute' => 'UNSIGNED', ], - ['col_name' => "col1", 'col_type' => 'varchar', - 'col_length' => 100, 'col_isNull' => 1, 'col_extra' => '', - 'col_default' => 1, 'col_collation' => '', 'col_attribute' => 'BINARY' + [ + 'col_name' => "col1", + 'col_type' => 'varchar', + 'col_length' => 100, + 'col_isNull' => 1, + 'col_extra' => '', + 'col_default' => 1, + 'col_collation' => '', + 'col_attribute' => 'BINARY', ], [ - 'col_name' => "col2", 'col_type' => 'DATETIME', - 'col_length' => 0, 'col_isNull' => 1, 'col_extra' => '', - 'col_default' => 'CURRENT_TIMESTAMP', 'col_collation' => '', - 'col_attribute' => 'on update CURRENT_TIMESTAMP' - ] + 'col_name' => "col2", + 'col_type' => 'DATETIME', + 'col_length' => 0, + 'col_isNull' => 1, + 'col_extra' => '', + 'col_default' => 'CURRENT_TIMESTAMP', + 'col_collation' => '', + 'col_attribute' => 'on update CURRENT_TIMESTAMP', + ], ]; /** @@ -111,9 +137,18 @@ class CentralColumnsTest extends TestCase ->will( $this->returnValue( [ - "id" => ["Type" => "integer", "Null" => "NO"], - "col1" => ["Type" => 'varchar(100)', "Null" => "YES"], - "col2" => ["Type" => 'DATETIME', "Null" => "NO"] + "id" => [ + "Type" => "integer", + "Null" => "NO", + ], + "col1" => [ + "Type" => 'varchar(100)', + "Null" => "YES", + ], + "col2" => [ + "Type" => 'DATETIME', + "Null" => "NO", + ], ] ) ); @@ -168,7 +203,7 @@ class CentralColumnsTest extends TestCase [ 'user' => 'pma_user', 'db' => 'phpmyadmin', - 'table' => 'pma_central_columns' + 'table' => 'pma_central_columns', ], $this->centralColumns->getParams() ); @@ -345,10 +380,13 @@ class CentralColumnsTest extends TestCase DatabaseInterface::CONNECT_CONTROL ) ->will( - $this->returnValue(['id','col1']) + $this->returnValue(['id', 'col1']) ); $this->assertEquals( - ["id", "col1"], + [ + "id", + "col1", + ], $this->centralColumns->getFromTable( $db, $table @@ -433,14 +471,38 @@ class CentralColumnsTest extends TestCase public function testUpdateMultipleColumn() { $_POST['db'] = 'phpmyadmin'; - $_POST['orig_col_name'] = ["col1","col2"]; - $_POST['field_name'] = ["col1","col2"]; - $_POST['field_default_type'] = ["",""]; - $_POST['col_extra'] = ["",""]; - $_POST['field_length'] = ["",""]; - $_POST['field_attribute'] = ["",""]; - $_POST['field_type'] = ["",""]; - $_POST['field_collation'] = ["",""]; + $_POST['orig_col_name'] = [ + "col1", + "col2", + ]; + $_POST['field_name'] = [ + "col1", + "col2", + ]; + $_POST['field_default_type'] = [ + "", + "", + ]; + $_POST['col_extra'] = [ + "", + "", + ]; + $_POST['field_length'] = [ + "", + "", + ]; + $_POST['field_attribute'] = [ + "", + "", + ]; + $_POST['field_type'] = [ + "", + "", + ]; + $_POST['field_collation'] = [ + "", + "", + ]; $this->assertTrue( $this->centralColumns->updateMultipleColumn() ); @@ -466,7 +528,10 @@ class CentralColumnsTest extends TestCase $this->returnValue($this->columnData) ); $result = $this->centralColumns->getHtmlForEditingPage( - ["col1", "col2"], + [ + "col1", + "col2", + ], 'phpmyadmin' ); $this->assertContains( @@ -474,8 +539,14 @@ class CentralColumnsTest extends TestCase $result ); $header_cells = [ - __('Name'), __('Type'), __('Length/Values'), __('Default'), - __('Collation'), __('Attributes'), __('Null'), __('A_I') + __('Name'), + __('Type'), + __('Length/Values'), + __('Default'), + __('Collation'), + __('Attributes'), + __('Null'), + __('A_I'), ]; $this->assertContains( $this->callProtectedMethod( diff --git a/test/classes/CharsetsTest.php b/test/classes/CharsetsTest.php index 046d9e7dc7..ddd3079e8d 100644 --- a/test/classes/CharsetsTest.php +++ b/test/classes/CharsetsTest.php @@ -54,95 +54,362 @@ class CharsetsTest extends TestCase public function collationDescr() { return [ - ['binary', 'Binary'], - ['foo_bulgarian_bar', 'Bulgarian'], - ['gb2312_chinese', 'Simplified Chinese'], - ['gbk_chinese', 'Simplified Chinese'], - ['big5_chinese_ci', 'Traditional Chinese, case-insensitive'], - ['big5_chinese', 'Traditional Chinese'], - ['foo_ci_bar', 'Unknown, case-insensitive'], - ['foo_croatian_bar', 'Croatian'], - ['foo_czech_bar', 'Czech'], - ['foo_danish_bar', 'Danish'], - ['foo_english_bar', 'English'], - ['foo_esperanto_bar', 'Esperanto'], - ['foo_estonian_bar', 'Estonian'], - ['foo_german1_bar', 'German (dictionary order)'], - ['foo_german2_bar', 'German (phone book order)'], - ['foo_hungarian_bar', 'Hungarian'], - ['foo_icelandic_bar', 'Icelandic'], - ['foo_japanese_bar', 'Japanese'], - ['foo_latvian_bar', 'Latvian'], - ['foo_lithuanian_bar', 'Lithuanian'], - ['foo_korean_bar', 'Korean'], - ['foo_persian_bar', 'Persian'], - ['foo_polish_bar', 'Polish'], - ['foo_roman_bar', 'West European'], - ['foo_romanian_bar', 'Romanian'], - ['foo_slovak_bar', 'Slovak'], - ['foo_slovenian_bar', 'Slovenian'], - ['foo_spanish_bar', 'Spanish (modern)'], - ['foo_spanish2_bar', 'Spanish (traditional)'], - ['foo_swedish_bar', 'Swedish'], - ['foo_thai_bar', 'Thai'], - ['foo_turkish_bar', 'Turkish'], - ['foo_ukrainian_bar', 'Ukrainian'], - ['foo_unicode_bar', 'Unicode'], - ['ucs2', 'Unicode'], - ['utf8', 'Unicode'], - ['ascii', 'West European'], - ['cp850', 'West European'], - ['dec8', 'West European'], - ['hp8', 'West European'], - ['latin1', 'West European'], - ['cp1250', 'Central European'], - ['cp852', 'Central European'], - ['latin2', 'Central European'], - ['macce', 'Central European'], - ['cp866', 'Russian'], - ['koi8r', 'Russian'], - ['gb2312', 'Simplified Chinese'], - ['gbk', 'Simplified Chinese'], - ['sjis', 'Japanese'], - ['ujis', 'Japanese'], - ['cp932', 'Japanese'], - ['eucjpms', 'Japanese'], - ['cp1257', 'Baltic'], - ['latin7', 'Baltic'], - ['armscii8', 'Armenian'], - ['armscii', 'Armenian'], - ['big5', 'Traditional Chinese'], - ['cp1251', 'Cyrillic'], - ['cp1256', 'Arabic'], - ['euckr', 'Korean'], - ['hebrew', 'Hebrew'], - ['geostd8', 'Georgian'], - ['greek', 'Greek'], - ['keybcs2', 'Czech-Slovak'], - ['koi8u', 'Ukrainian'], - ['latin5', 'Turkish'], - ['swe7', 'Swedish'], - ['tis620', 'Thai'], - ['foobar', 'Unknown'], - ['foo_test_bar', 'Unknown'], - ['foo_bin_bar', 'Unknown, binary'], - ['utf8mb4_0900_ai_ci', 'Unicode (UCA 9.0.0), accent-insensitive, case-insensitive'], - ['utf8mb4_unicode_520_ci', 'Unicode (UCA 5.2.0), case-insensitive'], - ['utf8mb4_unicode_ci', 'Unicode (UCA 4.0.0), case-insensitive'], - ['utf8mb4_tr_0900_ai_ci', 'Turkish (UCA 9.0.0), accent-insensitive, case-insensitive'], - ['utf8mb4_turkish_ci', 'Turkish (UCA 4.0.0), case-insensitive'], - ['utf32_thai_520_w2', 'Thai (UCA 5.2.0), multi-level'], - ['utf8mb4_czech_ci', 'Czech (UCA 4.0.0), case-insensitive'], - ['cp1250_czech_cs', 'Czech, case-sensitive'], - ['latin1_general_ci', 'West European, case-insensitive'], - ['utf8mb4_bin', 'Unicode (UCA 4.0.0), binary'], - ['utf8mb4_croatian_mysql561_ci', 'Croatian (MySQL 5.6.1), case-insensitive'], - ['ucs2_general_mysql500_ci', 'Unicode (MySQL 5.0.0), case-insensitive'], - ['utf32_general_ci', 'Unicode, case-insensitive'], - ['utf8mb4_es_trad_0900_ai_ci', 'Spanish (traditional) (UCA 9.0.0), accent-insensitive, case-insensitive'], - ['utf8mb4_es_0900_ai_ci', 'Spanish (modern) (UCA 9.0.0), accent-insensitive, case-insensitive'], - ['utf8mb4_de_pb_0900_ai_ci', 'German (phone book order) (UCA 9.0.0), accent-insensitive, case-insensitive'], - ['utf8mb4_de_0900_ai_ci', 'German (dictionary order) (UCA 9.0.0), accent-insensitive, case-insensitive'], + [ + 'binary', + 'Binary', + ], + [ + 'foo_bulgarian_bar', + 'Bulgarian', + ], + [ + 'gb2312_chinese', + 'Simplified Chinese', + ], + [ + 'gbk_chinese', + 'Simplified Chinese', + ], + [ + 'big5_chinese_ci', + 'Traditional Chinese, case-insensitive', + ], + [ + 'big5_chinese', + 'Traditional Chinese', + ], + [ + 'foo_ci_bar', + 'Unknown, case-insensitive', + ], + [ + 'foo_croatian_bar', + 'Croatian', + ], + [ + 'foo_czech_bar', + 'Czech', + ], + [ + 'foo_danish_bar', + 'Danish', + ], + [ + 'foo_english_bar', + 'English', + ], + [ + 'foo_esperanto_bar', + 'Esperanto', + ], + [ + 'foo_estonian_bar', + 'Estonian', + ], + [ + 'foo_german1_bar', + 'German (dictionary order)', + ], + [ + 'foo_german2_bar', + 'German (phone book order)', + ], + [ + 'foo_hungarian_bar', + 'Hungarian', + ], + [ + 'foo_icelandic_bar', + 'Icelandic', + ], + [ + 'foo_japanese_bar', + 'Japanese', + ], + [ + 'foo_latvian_bar', + 'Latvian', + ], + [ + 'foo_lithuanian_bar', + 'Lithuanian', + ], + [ + 'foo_korean_bar', + 'Korean', + ], + [ + 'foo_persian_bar', + 'Persian', + ], + [ + 'foo_polish_bar', + 'Polish', + ], + [ + 'foo_roman_bar', + 'West European', + ], + [ + 'foo_romanian_bar', + 'Romanian', + ], + [ + 'foo_slovak_bar', + 'Slovak', + ], + [ + 'foo_slovenian_bar', + 'Slovenian', + ], + [ + 'foo_spanish_bar', + 'Spanish (modern)', + ], + [ + 'foo_spanish2_bar', + 'Spanish (traditional)', + ], + [ + 'foo_swedish_bar', + 'Swedish', + ], + [ + 'foo_thai_bar', + 'Thai', + ], + [ + 'foo_turkish_bar', + 'Turkish', + ], + [ + 'foo_ukrainian_bar', + 'Ukrainian', + ], + [ + 'foo_unicode_bar', + 'Unicode', + ], + [ + 'ucs2', + 'Unicode', + ], + [ + 'utf8', + 'Unicode', + ], + [ + 'ascii', + 'West European', + ], + [ + 'cp850', + 'West European', + ], + [ + 'dec8', + 'West European', + ], + [ + 'hp8', + 'West European', + ], + [ + 'latin1', + 'West European', + ], + [ + 'cp1250', + 'Central European', + ], + [ + 'cp852', + 'Central European', + ], + [ + 'latin2', + 'Central European', + ], + [ + 'macce', + 'Central European', + ], + [ + 'cp866', + 'Russian', + ], + [ + 'koi8r', + 'Russian', + ], + [ + 'gb2312', + 'Simplified Chinese', + ], + [ + 'gbk', + 'Simplified Chinese', + ], + [ + 'sjis', + 'Japanese', + ], + [ + 'ujis', + 'Japanese', + ], + [ + 'cp932', + 'Japanese', + ], + [ + 'eucjpms', + 'Japanese', + ], + [ + 'cp1257', + 'Baltic', + ], + [ + 'latin7', + 'Baltic', + ], + [ + 'armscii8', + 'Armenian', + ], + [ + 'armscii', + 'Armenian', + ], + [ + 'big5', + 'Traditional Chinese', + ], + [ + 'cp1251', + 'Cyrillic', + ], + [ + 'cp1256', + 'Arabic', + ], + [ + 'euckr', + 'Korean', + ], + [ + 'hebrew', + 'Hebrew', + ], + [ + 'geostd8', + 'Georgian', + ], + [ + 'greek', + 'Greek', + ], + [ + 'keybcs2', + 'Czech-Slovak', + ], + [ + 'koi8u', + 'Ukrainian', + ], + [ + 'latin5', + 'Turkish', + ], + [ + 'swe7', + 'Swedish', + ], + [ + 'tis620', + 'Thai', + ], + [ + 'foobar', + 'Unknown', + ], + [ + 'foo_test_bar', + 'Unknown', + ], + [ + 'foo_bin_bar', + 'Unknown, binary', + ], + [ + 'utf8mb4_0900_ai_ci', + 'Unicode (UCA 9.0.0), accent-insensitive, case-insensitive', + ], + [ + 'utf8mb4_unicode_520_ci', + 'Unicode (UCA 5.2.0), case-insensitive', + ], + [ + 'utf8mb4_unicode_ci', + 'Unicode (UCA 4.0.0), case-insensitive', + ], + [ + 'utf8mb4_tr_0900_ai_ci', + 'Turkish (UCA 9.0.0), accent-insensitive, case-insensitive', + ], + [ + 'utf8mb4_turkish_ci', + 'Turkish (UCA 4.0.0), case-insensitive', + ], + [ + 'utf32_thai_520_w2', + 'Thai (UCA 5.2.0), multi-level', + ], + [ + 'utf8mb4_czech_ci', + 'Czech (UCA 4.0.0), case-insensitive', + ], + [ + 'cp1250_czech_cs', + 'Czech, case-sensitive', + ], + [ + 'latin1_general_ci', + 'West European, case-insensitive', + ], + [ + 'utf8mb4_bin', + 'Unicode (UCA 4.0.0), binary', + ], + [ + 'utf8mb4_croatian_mysql561_ci', + 'Croatian (MySQL 5.6.1), case-insensitive', + ], + [ + 'ucs2_general_mysql500_ci', + 'Unicode (MySQL 5.0.0), case-insensitive', + ], + [ + 'utf32_general_ci', + 'Unicode, case-insensitive', + ], + [ + 'utf8mb4_es_trad_0900_ai_ci', + 'Spanish (traditional) (UCA 9.0.0), accent-insensitive, case-insensitive', + ], + [ + 'utf8mb4_es_0900_ai_ci', + 'Spanish (modern) (UCA 9.0.0), accent-insensitive, case-insensitive', + ], + [ + 'utf8mb4_de_pb_0900_ai_ci', + 'German (phone book order) (UCA 9.0.0), accent-insensitive, case-insensitive', + ], + [ + 'utf8mb4_de_0900_ai_ci', + 'German (dictionary order) (UCA 9.0.0), accent-insensitive, case-insensitive', + ], ]; } diff --git a/test/classes/Config/ConfigFileTest.php b/test/classes/Config/ConfigFileTest.php index 64704d0339..6f796eab5b 100644 --- a/test/classes/Config/ConfigFileTest.php +++ b/test/classes/Config/ConfigFileTest.php @@ -151,7 +151,10 @@ class ConfigFileTest extends PmaTestCase $this->object->set('c', 3); $this->assertEquals( - ['a' => 1, 'c' => 3], + [ + 'a' => 1, + 'c' => 3, + ], $this->object->getConfig() ); @@ -162,7 +165,11 @@ class ConfigFileTest extends PmaTestCase $this->object->set('b', 2); $this->assertEquals( - ['a' => 1, 'b' => 2, 'c' => 3], + [ + 'a' => 1, + 'b' => 2, + 'c' => 3, + ], $this->object->getConfig() ); } @@ -178,7 +185,7 @@ class ConfigFileTest extends PmaTestCase $this->object->setCfgUpdateReadMapping( [ 'Servers/value1' => 'Servers/1/value1', - 'Servers/value2' => 'Servers/1/value2' + 'Servers/value2' => 'Servers/1/value2', ] ); $this->object->set('Servers/1/passthrough1', 1); @@ -192,8 +199,8 @@ class ConfigFileTest extends PmaTestCase 'passthrough1' => 1, 'passthrough2' => 2, 'value1' => 3 - ] - ] + ], + ], ], $this->object->getConfig() ); @@ -376,7 +383,10 @@ class ConfigFileTest extends PmaTestCase $this->object->updateWithGlobalConfig(['key' => 'ABC']); $this->assertEquals( - ['key' => 'ABC', 'key2' => 'value'], + [ + 'key' => 'ABC', + 'key2' => 'value', + ], $this->object->getConfig() ); } @@ -455,11 +465,19 @@ class ConfigFileTest extends PmaTestCase $this->object->get('ServerDefault') ); $this->assertEquals( - ['Servers' => [1 => ['x' => 1], 2 => ['x' => 4]]], + [ + 'Servers' => [ + 1 => ['x' => 1], + 2 => ['x' => 4], + ], + ], $this->object->getConfig() ); $this->assertEquals( - ['Servers/1/x' => 1, 'Servers/2/x' => 4], + [ + 'Servers/1/x' => 1, + 'Servers/2/x' => 4, + ], $this->object->getConfigArray() ); } @@ -476,7 +494,10 @@ class ConfigFileTest extends PmaTestCase $this->object->set('Servers/2/x', 'b'); $this->assertEquals( - [1 => ['x' => 'a'], 2 => ['x' => 'b']], + [ + 1 => ['x' => 'a'], + 2 => ['x' => 'b'], + ], $this->object->getServers() ); } @@ -502,8 +523,8 @@ class ConfigFileTest extends PmaTestCase "user" => "testUser", "host" => "example.com", "port" => "21" - ] - ] + ], + ], ] ); $this->assertEquals( @@ -521,8 +542,8 @@ class ConfigFileTest extends PmaTestCase "port" => "21", "socket" => "123", "password" => "", - ] - ] + ], + ], ] ); $this->assertEquals( @@ -539,8 +560,8 @@ class ConfigFileTest extends PmaTestCase "host" => "example.com", "port" => "21", "password" => "testPass" - ] - ] + ], + ], ] ); $this->assertEquals( @@ -592,7 +613,10 @@ class ConfigFileTest extends PmaTestCase $this->assertEquals( [ self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_value, - 'Array/test' => ['x', 'y'] + 'Array/test' => [ + 'x', + 'y', + ] ], $this->object->getConfigArray() ); diff --git a/test/classes/Config/FormDisplayTemplateTest.php b/test/classes/Config/FormDisplayTemplateTest.php index 66463998ab..160b446d38 100644 --- a/test/classes/Config/FormDisplayTemplateTest.php +++ b/test/classes/Config/FormDisplayTemplateTest.php @@ -117,7 +117,10 @@ class FormDisplayTemplateTest extends TestCase public function testDisplayFieldsetTop() { $attributes = ['name' => 'attrname']; - $errors = ['e1', 'e2']; + $errors = [ + 'e1', + 'e2', + ]; $result = $this->formDisplayTemplate->displayFieldsetTop("TitleTest", "DescTest", $errors, $attributes); @@ -318,7 +321,10 @@ class FormDisplayTemplateTest extends TestCase // select case 1 $opts['values_escaped'] = true; - $opts['values_disabled'] = [1, 2]; + $opts['values_disabled'] = [ + 1, + 2, + ]; $opts['values'] = [ 1 => 'test', 'key1' => true, @@ -355,7 +361,10 @@ class FormDisplayTemplateTest extends TestCase // select case 2 $opts['values_escaped'] = false; - $opts['values_disabled'] = [1, 2]; + $opts['values_disabled'] = [ + 1, + 2, + ]; $opts['values'] = [ 'a<b' => 'c&d', 'key1' => true, @@ -387,7 +396,10 @@ class FormDisplayTemplateTest extends TestCase 'test/path', 'testName', 'list', - ['foo', 'bar'], + [ + 'foo', + 'bar', + ], '', true, $opts @@ -529,8 +541,11 @@ class FormDisplayTemplateTest extends TestCase public function testAddJsValidate() { $validators = [ - 'one' => ['\\\';', '\r\n\\\'<scrIpt></\' + \'script>'], - 'two' => [] + 'one' => [ + '\\\';', + '\r\n\\\'<scrIpt></\' + \'script>', + ], + 'two' => [], ]; $js = []; @@ -542,7 +557,7 @@ class FormDisplayTemplateTest extends TestCase 'validateField(\'testID\', \'PMA_\\\';\', true, ' . '[\'\\\\r\\\\n\\\\\\\'' . '<scrIpt></\\\' + \\\'script>\'])', - 'validateField(\'testID\', \'PMA_\', true)' + 'validateField(\'testID\', \'PMA_\', true)', ], $js ); @@ -585,7 +600,10 @@ class FormDisplayTemplateTest extends TestCase */ public function testDisplayErrors() { - $errors = ['<err1>', '&err2']; + $errors = [ + '<err1>', + '&err2', + ]; $result = $this->formDisplayTemplate->displayErrors('err"Name1"', $errors); diff --git a/test/classes/Config/FormDisplayTest.php b/test/classes/Config/FormDisplayTest.php index 782200552e..ba92b13984 100644 --- a/test/classes/Config/FormDisplayTest.php +++ b/test/classes/Config/FormDisplayTest.php @@ -84,8 +84,8 @@ class FormDisplayTest extends PmaTestCase "1" => [ 'test' => 1, 1 => ':group:end' - ] - ] + ], + ], ]; $this->object->registerForm('pma_testform', $array, 2); @@ -98,7 +98,7 @@ class FormDisplayTest extends PmaTestCase $this->assertEquals( [ "Servers/2/test" => "Servers/1/test", - "Servers/2/:group:end:0" => "Servers/1/:group:end:0" + "Servers/2/:group:end:0" => "Servers/1/:group:end:0", ], $this->readAttribute($this->object, '_systemPaths') ); @@ -106,7 +106,7 @@ class FormDisplayTest extends PmaTestCase $this->assertEquals( [ "Servers/2/test" => "Servers-2-test", - "Servers/2/:group:end:0" => "Servers-2-:group:end:0" + "Servers/2/:group:end:0" => "Servers-2-:group:end:0", ], $this->readAttribute($this->object, '_translatedPaths') ); @@ -172,11 +172,14 @@ class FormDisplayTest extends PmaTestCase $arr = [ "Servers/1/test" => ['e1'], - "foobar" => ['e2', 'e3'] + "foobar" => [ + 'e2', + 'e3', + ] ]; $sysArr = [ - "Servers/1/test" => "Servers/1/test2" + "Servers/1/test" => "Servers/1/test2", ]; $attrSystemPaths = $reflection->getProperty('_systemPaths'); @@ -215,12 +218,15 @@ class FormDisplayTest extends PmaTestCase $arr = [ "Servers/1/test" => ['e1'], - "Servers/2/test" => ['e2', 'e3'], - "Servers/3/test" => [] + "Servers/2/test" => [ + 'e2', + 'e3', + ], + "Servers/3/test" => [], ]; $sysArr = [ - "Servers/1/test" => "Servers/1/host" + "Servers/1/test" => "Servers/1/host", ]; $attrSystemPaths = $reflection->getProperty('_systemPaths'); @@ -235,9 +241,9 @@ class FormDisplayTest extends PmaTestCase [ 'Servers' => [ '1' => [ - 'test' => 'localhost' - ] - ] + 'test' => 'localhost', + ], + ], ], $_SESSION['ConfigFile0'] ); @@ -261,7 +267,10 @@ class FormDisplayTest extends PmaTestCase $this->assertTrue( $attrValidateSelect->invokeArgs( $this->object, - [&$value, $arr] + [ + &$value, + $arr, + ] ) ); @@ -270,7 +279,10 @@ class FormDisplayTest extends PmaTestCase $this->assertTrue( $attrValidateSelect->invokeArgs( $this->object, - [&$value, $arr] + [ + &$value, + $arr, + ] ) ); $this->assertEquals( @@ -283,7 +295,10 @@ class FormDisplayTest extends PmaTestCase $this->assertTrue( $attrValidateSelect->invokeArgs( $this->object, - [&$value, $arr] + [ + &$value, + $arr, + ] ) ); @@ -292,7 +307,10 @@ class FormDisplayTest extends PmaTestCase $this->assertFalse( $attrValidateSelect->invokeArgs( $this->object, - [&$value, $arr] + [ + &$value, + $arr, + ] ) ); } @@ -313,7 +331,10 @@ class FormDisplayTest extends PmaTestCase $attrErrors->setValue( $this->object, - [1, 2] + [ + 1, + 2, + ] ); $this->assertTrue( @@ -409,7 +430,10 @@ class FormDisplayTest extends PmaTestCase $method->invokeArgs( $this->object, - ['RecodingEngine', &$opts] + [ + 'RecodingEngine', + &$opts, + ] ); $expect['comment'] = ''; @@ -432,7 +456,10 @@ class FormDisplayTest extends PmaTestCase // ZipDump, GZipDump, BZipDump $method->invokeArgs( $this->object, - ['ZipDump', &$opts] + [ + 'ZipDump', + &$opts, + ] ); $comment = ''; @@ -456,7 +483,10 @@ class FormDisplayTest extends PmaTestCase $method->invokeArgs( $this->object, - ['GZipDump', &$opts] + [ + 'GZipDump', + &$opts, + ] ); $comment = ''; @@ -480,7 +510,10 @@ class FormDisplayTest extends PmaTestCase $method->invokeArgs( $this->object, - ['BZipDump', &$opts] + [ + 'BZipDump', + &$opts, + ] ); $comment = ''; @@ -510,7 +543,10 @@ class FormDisplayTest extends PmaTestCase $method->invokeArgs( $this->object, - ['MaxDbList', &$opts] + [ + 'MaxDbList', + &$opts, + ] ); $this->assertEquals( @@ -520,7 +556,10 @@ class FormDisplayTest extends PmaTestCase $method->invokeArgs( $this->object, - ['MaxTableList', &$opts] + [ + 'MaxTableList', + &$opts, + ] ); $this->assertEquals( @@ -530,7 +569,10 @@ class FormDisplayTest extends PmaTestCase $method->invokeArgs( $this->object, - ['QueryHistoryMax', &$opts] + [ + 'QueryHistoryMax', + &$opts, + ] ); $this->assertEquals( diff --git a/test/classes/Config/FormTest.php b/test/classes/Config/FormTest.php index e26dd03290..2836d5ee9e 100644 --- a/test/classes/Config/FormTest.php +++ b/test/classes/Config/FormTest.php @@ -40,7 +40,10 @@ class FormTest extends PmaTestCase $GLOBALS['server'] = 0; $this->object = new Form( 'pma_form_name', - ['pma_form1','pma_form2'], + [ + 'pma_form1', + 'pma_form2', + ], new ConfigFile(), 1 ); @@ -110,7 +113,10 @@ class FormTest extends PmaTestCase public function testGetOptionValueList() { $this->assertEquals( - ['NHibernate C# DO', 'NHibernate XML'], + [ + 'NHibernate C# DO', + 'NHibernate XML', + ], $this->object->getOptionValueList("Export/codegen_format") ); @@ -150,8 +156,8 @@ class FormTest extends PmaTestCase "bar" => [ 'test' => 1, 1 => ':group:end' - ] - ] + ], + ], ]; $method->invoke($this->object, $array, 'foo', 'pref'); @@ -202,8 +208,8 @@ class FormTest extends PmaTestCase "bar" => [ 'test' => 1, 1 => ':group:end' - ] - ] + ], + ], ]; $method->invoke($this->object, $array); diff --git a/test/classes/Config/ServerConfigChecksTest.php b/test/classes/Config/ServerConfigChecksTest.php index 603d7b9dde..d78e25bec1 100644 --- a/test/classes/Config/ServerConfigChecksTest.php +++ b/test/classes/Config/ServerConfigChecksTest.php @@ -64,7 +64,7 @@ class ServerConfigChecksTest extends PmaTestCase 'password' => 'password', 'AllowRoot' => true, 'AllowNoPassword' => true, - ] + ], ]; $_SESSION[$this->sessionID]['AllowArbitraryServer'] = true; @@ -121,8 +121,8 @@ class ServerConfigChecksTest extends PmaTestCase 'host' => 'localhost', 'ssl' => true, 'auth_type' => 'cookie', - 'AllowRoot' => false - ] + 'AllowRoot' => false, + ], ]; $_SESSION[$this->sessionID]['AllowArbitraryServer'] = false; @@ -158,8 +158,8 @@ class ServerConfigChecksTest extends PmaTestCase $_SESSION[$this->sessionID]['Servers'] = [ '1' => [ 'host' => 'localhost', - 'auth_type' => 'cookie' - ] + 'auth_type' => 'cookie', + ], ]; $configChecker = new ServerConfigChecks($GLOBALS['ConfigFile']); diff --git a/test/classes/ConfigTest.php b/test/classes/ConfigTest.php index a9b0f2ceb9..7492799fab 100644 --- a/test/classes/ConfigTest.php +++ b/test/classes/ConfigTest.php @@ -517,15 +517,96 @@ class ConfigTest extends PmaTestCase public function httpsParams() { return [ - ['http', '', '', '', '', 'http', 80, false], - ['http', '', 'http://', '', '', 'http', 80, false], - ['http', '', '', '', '', 'http', 443, true], - ['http', '', '', '', '', 'https', 80, true], - ['http', '', '', '', 'on', 'http', 80, true], - ['http', '', '', 'on', '', 'http', 80, true], - ['http', '', 'https://', '', '', 'http', 80, true], - ['http', 'on', '', '', '', 'http', 80, true], - ['https', '', '', '', '', 'http', 80, true], + [ + 'http', + '', + '', + '', + '', + 'http', + 80, + false, + ], + [ + 'http', + '', + 'http://', + '', + '', + 'http', + 80, + false, + ], + [ + 'http', + '', + '', + '', + '', + 'http', + 443, + true, + ], + [ + 'http', + '', + '', + '', + '', + 'https', + 80, + true, + ], + [ + 'http', + '', + '', + '', + 'on', + 'http', + 80, + true, + ], + [ + 'http', + '', + '', + 'on', + '', + 'http', + 80, + true, + ], + [ + 'http', + '', + 'https://', + '', + '', + 'http', + 80, + true, + ], + [ + 'http', + 'on', + '', + '', + '', + 'http', + 80, + true, + ], + [ + 'https', + '', + '', + '', + '', + 'http', + 80, + true, + ], ]; } @@ -551,7 +632,7 @@ class ConfigTest extends PmaTestCase 'PMA_IS_GD2', 'PMA_USR_OS', 'PMA_USR_BROWSER_VER', - 'PMA_USR_BROWSER_AGENT' + 'PMA_USR_BROWSER_AGENT', ]; foreach ($defines as $define) { @@ -1302,12 +1383,15 @@ class ConfigTest extends PmaTestCase ], 'empty_host' => [ [1 => ['host' => '']], - ['verbose' => 'Server 1', 'host' => ''], + [ + 'verbose' => 'Server 1', + 'host' => '' + ], ], 'invalid' => [ ['invalid' => ['host' => '127.0.0.1']], ['host' => '127.0.0.1'], - true + true, ], ]; } @@ -1356,14 +1440,24 @@ class ConfigTest extends PmaTestCase 2, ], 'verbose' => [ - [1 => ['verbose' => 'Server 1', 'host' => '']], + [ + 1 => [ + 'verbose' => 'Server 1', + 'host' => '' + ], + ], 'Server 1', - 1 + 1, ], 'md5' => [ - [66 => ['verbose' => 'Server 1', 'host' => '']], + [ + 66 => [ + 'verbose' => 'Server 1', + 'host' => '' + ], + ], '753f173bd4ac8a45eae0fe9a4fbe0fc0', - 66 + 66, ], 'nonexisting_string' => [ [1 => []], diff --git a/test/classes/Controllers/Database/DatabaseStructureControllerTest.php b/test/classes/Controllers/Database/DatabaseStructureControllerTest.php index 1f548e6470..9ad7b54fd4 100644 --- a/test/classes/Controllers/Database/DatabaseStructureControllerTest.php +++ b/test/classes/Controllers/Database/DatabaseStructureControllerTest.php @@ -213,7 +213,7 @@ class DatabaseStructureControllerTest extends PmaTestCase 'Data_free' => 300, ]; list($current_table,,,,, $overhead_size, $sum_size) - = $method->invokeArgs($ctrl, [$current_table, 0, 0, 0, 0, 0, 0,]); + = $method->invokeArgs($ctrl, [$current_table, 0, 0, 0, 0, 0, 0]); $this->assertEquals( 6, $current_table['Rows'] @@ -229,7 +229,7 @@ class DatabaseStructureControllerTest extends PmaTestCase unset($current_table['Data_free']); list($current_table,,,,, $overhead_size,) - = $method->invokeArgs($ctrl, [$current_table, 0, 0, 0, 0, 0, 0,]); + = $method->invokeArgs($ctrl, [$current_table, 0, 0, 0, 0, 0, 0]); $this->assertEquals(0, $overhead_size); $is_show_stats = false; @@ -249,7 +249,7 @@ class DatabaseStructureControllerTest extends PmaTestCase $container->get('db') ); list($current_table,,,,,,) - = $method->invokeArgs($ctrl, [$current_table, 0, 0, 0, 0, 0, 0,]); + = $method->invokeArgs($ctrl, [$current_table, 0, 0, 0, 0, 0, 0]); $this->assertArrayNotHasKey('Row', $current_table); } @@ -317,7 +317,10 @@ class DatabaseStructureControllerTest extends PmaTestCase ); $_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']] = [ - ['db' => 'db', 'table' => 'table'] + [ + 'db' => 'db', + 'table' => 'table', + ], ]; $this->assertEquals( @@ -350,7 +353,10 @@ class DatabaseStructureControllerTest extends PmaTestCase ->will( $this->returnValue( [ - ['db' => 'db', 'table' => 'table'], + [ + 'db' => 'db', + 'table' => 'table', + ], ] ) ); @@ -369,7 +375,10 @@ class DatabaseStructureControllerTest extends PmaTestCase $user = 'abcdefg'; $favorite_table = [ $user => [ - ['db' => 'db', 'table' => 'table'] + [ + 'db' => 'db', + 'table' => 'table', + ], ], ]; @@ -414,8 +423,8 @@ class DatabaseStructureControllerTest extends PmaTestCase $ctrl, [ [ - 'TABLE_NAME' => 'table' - ] + 'TABLE_NAME' => 'table', + ], ] ); $ctrl->handleRealRowCountRequestAction(); @@ -424,8 +433,8 @@ class DatabaseStructureControllerTest extends PmaTestCase $expected_result = [ [ 'table' => 'table', - 'row_count' => 6 - ] + 'row_count' => 6, + ], ]; $this->assertEquals( json_encode($expected_result), diff --git a/test/classes/Controllers/Server/ServerBinlogControllerTest.php b/test/classes/Controllers/Server/ServerBinlogControllerTest.php index 807bde4680..a9fee426a8 100644 --- a/test/classes/Controllers/Server/ServerBinlogControllerTest.php +++ b/test/classes/Controllers/Server/ServerBinlogControllerTest.php @@ -56,8 +56,14 @@ class ServerBinlogControllerTest extends PmaTestCase Util::cacheSet('profiling_supported', true); $binary_log_file_names = []; - $binary_log_file_names[] = ["Log_name" => "index1", "File_size" => 100]; - $binary_log_file_names[] = ["Log_name" => "index2", "File_size" => 200]; + $binary_log_file_names[] = [ + "Log_name" => "index1", + "File_size" => 100, + ]; + $binary_log_file_names[] = [ + "Log_name" => "index2", + "File_size" => 200, + ]; //Mock DBI $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -138,15 +144,15 @@ class ServerBinlogControllerTest extends PmaTestCase null, 1, true, - ["log1" => "logd"] + ["log1" => "logd"], ], [ ["log2" => "logb"], null, 0, false, - 'executed' - ] + 'executed', + ], ]; $value = [ 'Info' => "index1_Info", diff --git a/test/classes/Controllers/Server/ServerCollationsControllerTest.php b/test/classes/Controllers/Server/ServerCollationsControllerTest.php index eff71bf31e..6c43a9b153 100644 --- a/test/classes/Controllers/Server/ServerCollationsControllerTest.php +++ b/test/classes/Controllers/Server/ServerCollationsControllerTest.php @@ -49,7 +49,12 @@ class ServerCollationsControllerTest extends PmaTestCase */ public function testPMAGetHtmlForCharsets() { - $mysql_charsets = ["armscii8", "ascii", "big5", "binary"]; + $mysql_charsets = [ + "armscii8", + "ascii", + "big5", + "binary", + ]; $mysql_collations = [ "armscii8" => ["armscii8"], "ascii" => ["ascii"], diff --git a/test/classes/Controllers/Server/ServerDatabasesControllerTest.php b/test/classes/Controllers/Server/ServerDatabasesControllerTest.php index 6ef9e4732f..38ada0eda9 100644 --- a/test/classes/Controllers/Server/ServerDatabasesControllerTest.php +++ b/test/classes/Controllers/Server/ServerDatabasesControllerTest.php @@ -83,7 +83,7 @@ class ServerDatabasesControllerTest extends PmaTestCase ["SCHEMA_NAME" => "information_schema"], ["SCHEMA_NAME" => "mysql"], ["SCHEMA_NAME" => "performance_schema"], - ["SCHEMA_NAME" => "phpmyadmin"] + ["SCHEMA_NAME" => "phpmyadmin"], ]; $property = $class->getProperty('_databases'); $property->setAccessible(true); @@ -109,7 +109,10 @@ class ServerDatabasesControllerTest extends PmaTestCase $property->setAccessible(true); $property->setValue($ctrl, 'asc'); - $replication_types = ["master", "slave"]; + $replication_types = [ + "master", + "slave", + ]; $html = $method->invoke($ctrl, $replication_types); @@ -264,7 +267,7 @@ class ServerDatabasesControllerTest extends PmaTestCase 'disp_name' => __('Collation'), 'description_function' => [ Charsets::class, - 'getCollationDescr' + 'getCollationDescr', ], 'format' => 'string', 'footer' => '' @@ -272,32 +275,32 @@ class ServerDatabasesControllerTest extends PmaTestCase 'SCHEMA_TABLES' => [ 'disp_name' => __('Tables'), 'format' => 'number', - 'footer' => 0 + 'footer' => 0, ], 'SCHEMA_TABLE_ROWS' => [ 'disp_name' => __('Rows'), 'format' => 'number', - 'footer' => 0 + 'footer' => 0, ], 'SCHEMA_DATA_LENGTH' => [ 'disp_name' => __('Data'), 'format' => 'byte', - 'footer' => 0 + 'footer' => 0, ], 'SCHEMA_INDEX_LENGTH' => [ 'disp_name' => __('Indexes'), 'format' => 'byte', - 'footer' => 0 + 'footer' => 0, ], 'SCHEMA_LENGTH' => [ 'disp_name' => __('Total'), 'format' => 'byte', - 'footer' => 0 + 'footer' => 0, ], 'SCHEMA_DATA_FREE' => [ 'disp_name' => __('Overhead'), 'format' => 'byte', - 'footer' => 0 + 'footer' => 0, ] ], $method->invoke($ctrl) diff --git a/test/classes/Controllers/Server/ServerEnginesControllerTest.php b/test/classes/Controllers/Server/ServerEnginesControllerTest.php index 6a4cd8a3e5..b0b5c6aaa5 100644 --- a/test/classes/Controllers/Server/ServerEnginesControllerTest.php +++ b/test/classes/Controllers/Server/ServerEnginesControllerTest.php @@ -159,7 +159,10 @@ class ServerEnginesControllerTest extends PmaTestCase ); $this->assertContains( Url::getCommon( - ['engine' => $_REQUEST['engine'], 'page' => "Documentation"] + [ + 'engine' => $_REQUEST['engine'], + 'page' => "Documentation" + ] ), $html ); diff --git a/test/classes/Controllers/Server/ServerVariablesControllerTest.php b/test/classes/Controllers/Server/ServerVariablesControllerTest.php index 15ca3b63b2..a32a53a312 100644 --- a/test/classes/Controllers/Server/ServerVariablesControllerTest.php +++ b/test/classes/Controllers/Server/ServerVariablesControllerTest.php @@ -77,7 +77,7 @@ class ServerVariablesControllerTest extends PmaTestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_session_variable + $server_session_variable, ], [ "SHOW GLOBAL VARIABLES;", @@ -85,8 +85,8 @@ class ServerVariablesControllerTest extends PmaTestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_global_variables - ] + $server_global_variables, + ], ]; $dbi->expects($this->any())->method('fetchResult') @@ -133,7 +133,10 @@ class ServerVariablesControllerTest extends PmaTestCase KBSearch::loadTestData($slimData); //name is_numeric and the value type is byte - $args = [$nameForValueByte, "3"]; + $args = [ + $nameForValueByte, + "3", + ]; list($formattedValue, $isHtmlFormatted) = $method->invokeArgs($ctrl, $args); $this->assertEquals( '<abbr title="3">3 B</abbr>', @@ -142,7 +145,10 @@ class ServerVariablesControllerTest extends PmaTestCase $this->assertEquals(true, $isHtmlFormatted); //name is_numeric and the value type is not byte - $args = [$nameForValueNotByte, "3"]; + $args = [ + $nameForValueNotByte, + "3", + ]; list($formattedValue, $isHtmlFormatted) = $method->invokeArgs($ctrl, $args); $this->assertEquals( '3', @@ -151,7 +157,10 @@ class ServerVariablesControllerTest extends PmaTestCase $this->assertEquals(false, $isHtmlFormatted); //value is not a number - $args = [$nameForValueNotByte, "value"]; + $args = [ + $nameForValueNotByte, + "value", + ]; list($formattedValue, $isHtmlFormatted) = $method->invokeArgs($ctrl, $args); $this->assertEquals( 'value', @@ -311,7 +320,10 @@ class ServerVariablesControllerTest extends PmaTestCase $formatVariable = $class->getMethod('_formatVariable'); $formatVariable->setAccessible(true); - $args = [$name, "12"]; + $args = [ + $name, + "12", + ]; list($value, $isHtmlFormatted) = $formatVariable->invokeArgs($ctrl, $args); $this->assertContains( $value, @@ -324,7 +336,10 @@ class ServerVariablesControllerTest extends PmaTestCase $html ); - $args = [$name, "13"]; + $args = [ + $name, + "13", + ]; list($value, $isHtmlFormatted) = $formatVariable->invokeArgs($ctrl, $args); $this->assertContains( $value, diff --git a/test/classes/Controllers/Table/TableIndexesControllerTest.php b/test/classes/Controllers/Table/TableIndexesControllerTest.php index 42ba809d73..a96cad34c6 100644 --- a/test/classes/Controllers/Table/TableIndexesControllerTest.php +++ b/test/classes/Controllers/Table/TableIndexesControllerTest.php @@ -44,7 +44,7 @@ class TableIndexesControllerTest extends PmaTestCase $GLOBALS['cfg']['Server']['pmadb'] = ''; $GLOBALS['url_params'] = [ 'db' => 'db', - 'server' => 1 + 'server' => 1, ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -55,17 +55,17 @@ class TableIndexesControllerTest extends PmaTestCase [ "Schema" => "Schema1", "Key_name" => "Key_name1", - "Column_name" => "Column_name1" + "Column_name" => "Column_name1", ], [ "Schema" => "Schema2", "Key_name" => "Key_name2", - "Column_name" => "Column_name2" + "Column_name" => "Column_name2", ], [ "Schema" => "Schema3", "Key_name" => "Key_name3", - "Column_name" => "Column_name3" + "Column_name" => "Column_name3", ], ]; diff --git a/test/classes/Controllers/Table/TableRelationControllerTest.php b/test/classes/Controllers/Table/TableRelationControllerTest.php index d929327c6d..9c298cc80b 100644 --- a/test/classes/Controllers/Table/TableRelationControllerTest.php +++ b/test/classes/Controllers/Table/TableRelationControllerTest.php @@ -100,7 +100,9 @@ class TableRelationControllerTest extends PmaTestCase public function testGetDropdownValueForTableActionIsView() { $viewColumns = [ - 'viewCol', 'viewCol2', 'viewCol3' + 'viewCol', + 'viewCol2', + 'viewCol3', ]; $tableMock = $this->getMockBuilder('PhpMyAdmin\Table') ->disableOriginalConstructor() @@ -195,7 +197,10 @@ class TableRelationControllerTest extends PmaTestCase static $count = 0; if ($count == 0) { $count++; - return ['Engine' => 'InnoDB', 'Name' => 'table',]; + return [ + 'Engine' => 'InnoDB', + 'Name' => 'table' + ]; } return null; } @@ -257,7 +262,7 @@ class TableRelationControllerTest extends PmaTestCase ); $ctrl = $container->get( 'TableRelationController', - ['tbl_storage_engine' => 'INNODB',] + ['tbl_storage_engine' => 'INNODB'] ); $_POST['foreign'] = 'false'; diff --git a/test/classes/Controllers/Table/TableSearchControllerTest.php b/test/classes/Controllers/Table/TableSearchControllerTest.php index bde3620143..08052637d1 100644 --- a/test/classes/Controllers/Table/TableSearchControllerTest.php +++ b/test/classes/Controllers/Table/TableSearchControllerTest.php @@ -68,7 +68,7 @@ class TableSearchControllerTest extends PmaTestCase 'Type' => 'Type2', 'Null' => 'Null2', 'Collation' => 'Collation2', - ] + ], ]; $dbi->expects($this->any())->method('getColumns') ->will($this->returnValue($columns)); @@ -204,7 +204,7 @@ class TableSearchControllerTest extends PmaTestCase 'value4', 'value5', 'value6', - 'value7,value8' + 'value7,value8', ]; $_POST['criteriaColumnNames'] = [ 'name', @@ -222,7 +222,7 @@ class TableSearchControllerTest extends PmaTestCase 'type1', 'type2', 'type3', - 'type4' + 'type4', ]; $_POST['criteriaColumnCollations'] = [ "char1", @@ -240,7 +240,7 @@ class TableSearchControllerTest extends PmaTestCase "LIKE %...%", "REGEXP ^...$", "IN (...)", - "BETWEEN" + "BETWEEN", ]; $sql = $method->invoke($tableSearch); @@ -324,16 +324,28 @@ class TableSearchControllerTest extends PmaTestCase ); $_POST['criteriaColumnNames'] = [ - 'b', 'a', 'c', 'd' + 'b', + 'a', + 'c', + 'd', ]; $_POST['criteriaColumnOperators'] = [ - '<=', '=', 'IS NULL', 'IS NOT NULL' + '<=', + '=', + 'IS NULL', + 'IS NOT NULL', ]; $_POST['criteriaValues'] = [ - '10', '2', '', '' + '10', + '2', + '', + '', ]; $_POST['criteriaColumnTypes'] = [ - 'int(11)', 'int(11)', 'int(11)', 'int(11)' + 'int(11)', + 'int(11)', + 'int(11)', + 'int(11)', ]; $result = $method->invoke($ctrl); $this->assertEquals( @@ -357,7 +369,8 @@ class TableSearchControllerTest extends PmaTestCase $meta_two->length = 11; $meta_two->type = 'int'; $fields_meta = [ - $meta_one, $meta_two + $meta_one, + $meta_two, ]; $GLOBALS['dbi']->expects($this->any())->method('getFieldsMeta') ->will($this->returnValue($fields_meta)); @@ -395,7 +408,7 @@ class TableSearchControllerTest extends PmaTestCase $_POST['where_clause'] = '`col1` = 1'; $expected = [ 'col1' => 1, - 'col2' => 2 + 'col2' => 2, ]; $ctrl->getDataRowAction(); diff --git a/test/classes/Controllers/Table/TableStructureControllerTest.php b/test/classes/Controllers/Table/TableStructureControllerTest.php index edfeab3033..3b378d0aef 100644 --- a/test/classes/Controllers/Table/TableStructureControllerTest.php +++ b/test/classes/Controllers/Table/TableStructureControllerTest.php @@ -220,7 +220,10 @@ class TableStructureControllerTest extends PmaTestCase $method->invoke($ctrl) ); - $_POST['selected'] = ['a', 'b']; + $_POST['selected'] = [ + 'a', + 'b', + ]; $method->invoke($ctrl); $this->assertEquals( $_POST['selected'], @@ -260,14 +263,21 @@ class TableStructureControllerTest extends PmaTestCase $db = "PMA_db"; $table = "PMA_table"; $selected = [ - "table1", "table2" + "table1", + "table2", ]; $action = 'db_delete_row'; list($what, $query_type, $is_unset_submit_mult, $mult_btn, $centralColsError) = $method->invokeArgs( $ctrl, - [$submit_mult, $db, $table, $selected, $action] + [ + $submit_mult, + $db, + $table, + $selected, + $action, + ] ); //validate 1: $what @@ -305,7 +315,13 @@ class TableStructureControllerTest extends PmaTestCase list($what, $query_type, $is_unset_submit_mult, $mult_btn, $centralColsError) = $method->invokeArgs( $ctrl, - [$submit_mult, $db, $table, $selected, $action] + [ + $submit_mult, + $db, + $table, + $selected, + $action, + ] ); //validate 1: $what diff --git a/test/classes/CoreTest.php b/test/classes/CoreTest.php index c3a374e4f9..ccea6fabb2 100644 --- a/test/classes/CoreTest.php +++ b/test/classes/CoreTest.php @@ -64,11 +64,26 @@ class CoreTest extends PmaTestCase $arr = [ "int" => 1, "str" => "str_val", - "arr" => ['val1', 'val2', 'val3'], + "arr" => [ + 'val1', + 'val2', + 'val3', + ], "sarr" => [ - 'arr1' => [1, 2, 3], - [3, ['a', 'b', 'c'], 4] - ] + 'arr1' => [ + 1, + 2, + 3, + ], + [ + 3, + [ + 'a', + 'b', + 'c', + ], 4, + ] + ], ]; $this->assertEquals( @@ -152,11 +167,26 @@ class CoreTest extends PmaTestCase $arr = [ "int" => 1, "str" => "str_val", - "arr" => ['val1', 'val2', 'val3'], + "arr" => [ + 'val1', + 'val2', + 'val3', + ], "sarr" => [ - 'arr1' => [1, 2, 3], - [3, ['a', 'b', 'c'], 4] - ] + 'arr1' => [ + 1, + 2, + 3, + ], + [ + 3, + [ + 'a', + 'b', + 'c', + ], 4, + ] + ], ]; Core::arrayWrite('int', $arr, 5); @@ -206,11 +236,26 @@ class CoreTest extends PmaTestCase $arr = [ "int" => 1, "str" => "str_val", - "arr" => ['val1', 'val2', 'val3'], + "arr" => [ + 'val1', + 'val2', + 'val3', + ], "sarr" => [ - 'arr1' => [1, 2, 3], - [3, ['a', 'b', 'c'], 4] - ] + 'arr1' => [ + 1, + 2, + 3, + ], + [ + 3, + [ + 'a', + 'b', + 'c', + ], 4, + ] + ], ]; Core::arrayRemove('int', $arr); @@ -283,18 +328,78 @@ class CoreTest extends PmaTestCase public function providerTestGotoNowhere() { return [ - [null, [], false, false], - [null, [], true, false], - ['export.php', [], false, true], - ['export.php', [], true, true], - ['export.php', $this->goto_whitelist, false, true], - ['export.php', $this->goto_whitelist, true, true], - ['shell.php', $this->goto_whitelist, false, false], - ['shell.php', $this->goto_whitelist, true, false], - ['index.php?sql.php&test=true', $this->goto_whitelist, false, true], - ['index.php?sql.php&test=true', $this->goto_whitelist, true, false], - ['index.php%3Fsql.php%26test%3Dtrue', $this->goto_whitelist, false, true], - ['index.php%3Fsql.php%26test%3Dtrue', $this->goto_whitelist, true, false], + [ + null, + [], + false, + false, + ], + [ + null, + [], + true, + false, + ], + [ + 'export.php', + [], + false, + true, + ], + [ + 'export.php', + [], + true, + true, + ], + [ + 'export.php', + $this->goto_whitelist, + false, + true, + ], + [ + 'export.php', + $this->goto_whitelist, + true, + true, + ], + [ + 'shell.php', + $this->goto_whitelist, + false, + false, + ], + [ + 'shell.php', + $this->goto_whitelist, + true, + false, + ], + [ + 'index.php?sql.php&test=true', + $this->goto_whitelist, + false, + true, + ], + [ + 'index.php?sql.php&test=true', + $this->goto_whitelist, + true, + false, + ], + [ + 'index.php%3Fsql.php%26test%3Dtrue', + $this->goto_whitelist, + false, + true, + ], + [ + 'index.php%3Fsql.php%26test%3Dtrue', + $this->goto_whitelist, + true, + false, + ], ]; } @@ -334,49 +439,49 @@ class CoreTest extends PmaTestCase '/phpmyadmin/index.php/; cookieinj=value/', '/phpmyadmin/index.php/;%20cookieinj=value///', '/; cookieinj=value/', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], [ '', '/phpmyadmin/index.php/;%20cookieinj=value///', '/; cookieinj=value/', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], [ '', '//example.com/../phpmyadmin/index.php', '', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], [ '', '//example.com/../../.././phpmyadmin/index.php', '', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], [ '', '/page.php/malicouspathinfo?malicouspathinfo', 'malicouspathinfo', - '/page.php' + '/page.php', ], [ '/phpmyadmin/./index.php', '/phpmyadmin/./index.php', '', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], [ '/phpmyadmin/index.php', '/phpmyadmin/index.php', '', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], [ '', '/phpmyadmin/index.php', '', - '/phpmyadmin/index.php' + '/phpmyadmin/index.php', ], ]; } @@ -400,7 +505,10 @@ class CoreTest extends PmaTestCase public function testFatalErrorMessageWithArgs() { $message = "Fatal error #%d in file %s."; - $params = [1, 'error_file.php']; + $params = [ + 1, + 'error_file.php', + ]; $this->expectOutputRegex("/Fatal error #1 in file error_file.php./"); Core::fatalError($message, $params); @@ -435,12 +543,30 @@ class CoreTest extends PmaTestCase public function providerTestGetRealSize() { return [ - ['0', 0], - ['1kb', 1024], - ['1024k', 1024 * 1024], - ['8m', 8 * 1024 * 1024], - ['12gb', 12 * 1024 * 1024 * 1024], - ['1024', 1024], + [ + '0', + 0, + ], + [ + '1kb', + 1024, + ], + [ + '1024k', + 1024 * 1024, + ], + [ + '8m', + 8 * 1024 * 1024, + ], + [ + '12gb', + 12 * 1024 * 1024 * 1024, + ], + [ + '1024', + 1024, + ], ]; } @@ -482,14 +608,22 @@ class CoreTest extends PmaTestCase public function providerTestLinkURL() { return [ - ['https://wiki.phpmyadmin.net', - './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net' + [ + 'https://wiki.phpmyadmin.net', + './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net', + ], + [ + 'https://wiki.phpmyadmin.net', + './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net', ], - ['https://wiki.phpmyadmin.net', - './url.php?url=https%3A%2F%2Fwiki.phpmyadmin.net' + [ + 'wiki.phpmyadmin.net', + 'wiki.phpmyadmin.net', + ], + [ + 'index.php?db=phpmyadmin', + 'index.php?db=phpmyadmin', ], - ['wiki.phpmyadmin.net', 'wiki.phpmyadmin.net'], - ['index.php?db=phpmyadmin', 'index.php?db=phpmyadmin'] ]; } @@ -659,14 +793,38 @@ class CoreTest extends PmaTestCase public function provideTestIsAllowedDomain() { return [ - ['https://www.phpmyadmin.net/', true], - ['http://duckduckgo.com\\@github.com', false], - ['https://github.com/', true], - ['https://github.com:123/', false], - ['https://user:pass@github.com:123/', false], - ['https://user:pass@github.com/', false], - ['https://server.local/', true], - ['./relative/', false], + [ + 'https://www.phpmyadmin.net/', + true, + ], + [ + 'http://duckduckgo.com\\@github.com', + false, + ], + [ + 'https://github.com/', + true, + ], + [ + 'https://github.com:123/', + false, + ], + [ + 'https://user:pass@github.com:123/', + false, + ], + [ + 'https://user:pass@github.com/', + false, + ], + [ + 'https://server.local/', + true, + ], + [ + './relative/', + false, + ], ]; } @@ -694,18 +852,69 @@ class CoreTest extends PmaTestCase public static function providerTestNoVarType() { return [ - [0, false, 0], - [0, false, 1], - [1, false, null], - [1.1, false, null], - ['', false, null], - [' ', false, null], - ['0', false, null], - ['string', false, null], - [[], false, null], - [[1, 2, 3], false, null], - [true, false, null], - [false, false, null] + [ + 0, + false, + 0, + ], + [ + 0, + false, + 1, + ], + [ + 1, + false, + null, + ], + [ + 1.1, + false, + null, + ], + [ + '', + false, + null, + ], + [ + ' ', + false, + null, + ], + [ + '0', + false, + null, + ], + [ + 'string', + false, + null, + ], + [ + [], + false, + null, + ], + [ + [ + 1, + 2, + 3, + ], false, + null, + ], + [ + true, + false, + null, + ], + [ + false, + false, + null, + ], ]; } @@ -914,7 +1123,7 @@ class CoreTest extends PmaTestCase public function testValueInArray() { $var = 'a'; - $this->assertTrue(Core::isValid($var, ['a', 'b',])); + $this->assertTrue(Core::isValid($var, ['a', 'b'])); } /** @@ -925,7 +1134,7 @@ class CoreTest extends PmaTestCase public function testValueNotInArray() { $var = 'c'; - $this->assertFalse(Core::isValid($var, ['a', 'b',])); + $this->assertFalse(Core::isValid($var, ['a', 'b'])); } /** @@ -975,12 +1184,47 @@ class CoreTest extends PmaTestCase public function provideTestSimilarType() { return [ - [1, 1], - [1.5, 1.5], - [true, true], - ['string', "string"], - [[1, 2, 3.4], [1, 2, 3.4]], - [[1, '2', '3.4', 5, 'text'], ['1', '2', 3.4,'5']] + [ + 1, + 1, + ], + [ + 1.5, + 1.5, + ], + [ + true, + true, + ], + [ + 'string', + "string", + ], + [ + [ + 1, + 2, + 3.4, + ], [ + 1, + 2, + 3.4, + ], + ], + [ + [ + 1, + '2', + '3.4', + 5, + 'text', + ], [ + '1', + '2', + 3.4, + '5', + ], + ], ]; } @@ -1021,16 +1265,50 @@ class CoreTest extends PmaTestCase public function provideTestSafeUnserialize() { return [ - ['s:6:"foobar";', 'foobar'], - ['foobar', null], - ['b:0;', false], - ['O:1:"a":1:{s:5:"value";s:3:"100";}', null], - ['O:8:"stdClass":1:{s:5:"field";O:8:"stdClass":0:{}}', null], - ['a:2:{i:0;s:90:"1234567890;a345678901234567890123456789012345678901234567890123456789012345678901234567890";i:1;O:8:"stdClass":0:{}}', null], - [serialize([1, 2, 3]), [1, 2, 3]], - [serialize('string""'), 'string""'], - [serialize(['foo' => 'bar']), ['foo' => 'bar']], - [serialize(['1', new stdClass(), '2']), null], + [ + 's:6:"foobar";', + 'foobar', + ], + [ + 'foobar', + null, + ], + [ + 'b:0;', + false, + ], + [ + 'O:1:"a":1:{s:5:"value";s:3:"100";}', + null, + ], + [ + 'O:8:"stdClass":1:{s:5:"field";O:8:"stdClass":0:{}}', + null, + ], + [ + 'a:2:{i:0;s:90:"1234567890;a345678901234567890123456789012345678901234567890123456789012345678901234567890";i:1;O:8:"stdClass":0:{}}', + null, + ], + [ + serialize([1, 2, 3]), + [ + 1, + 2, + 3, + ], + ], + [ + serialize('string""'), + 'string""', + ], + [ + serialize(['foo' => 'bar']), + ['foo' => 'bar'], + ], + [ + serialize(['1', new stdClass(), '2']), + null, + ], ]; } @@ -1060,10 +1338,22 @@ class CoreTest extends PmaTestCase public function provideTestSanitizeMySQLHost() { return [ - ['p:foo.bar', 'foo.bar'], - ['p:p:foo.bar', 'foo.bar'], - ['bar.baz', 'bar.baz'], - ['P:example.com', 'example.com'], + [ + 'p:foo.bar', + 'foo.bar', + ], + [ + 'p:p:foo.bar', + 'foo.bar', + ], + [ + 'bar.baz', + 'bar.baz', + ], + [ + 'P:example.com', + 'example.com', + ], ]; } diff --git a/test/classes/CreateAddFieldTest.php b/test/classes/CreateAddFieldTest.php index a894f24d9c..9868f35586 100644 --- a/test/classes/CreateAddFieldTest.php +++ b/test/classes/CreateAddFieldTest.php @@ -59,14 +59,17 @@ class CreateAddFieldTest extends TestCase public function providerGetPartitionsDefinition() { return [ - ['', []], + [ + '', + [], + ], [ ' PARTITION BY HASH (EXPR()) PARTITIONS 2', [ 'partition_by' => 'HASH', 'partition_expr' => 'EXPR()', 'partition_count' => '2', - ] + ], ], ]; } @@ -99,7 +102,9 @@ class CreateAddFieldTest extends TestCase { return [ [ - 'CREATE TABLE `db`.`table` ();', 'db', 'table', + 'CREATE TABLE `db`.`table` ();', + 'db', + 'table', [ 'field_name' => [], 'primary_indexes' => '{}', @@ -107,7 +112,7 @@ class CreateAddFieldTest extends TestCase 'unique_indexes' => '{}', 'fulltext_indexes' => '{}', 'spatial_indexes' => '{}', - ] + ], ], ]; } @@ -137,7 +142,10 @@ class CreateAddFieldTest extends TestCase public function providerGetNumberOfFieldsFromRequest() { return [ - [4, []], + [ + 4, + [], + ], ]; } } diff --git a/test/classes/Database/Designer/CommonTest.php b/test/classes/Database/Designer/CommonTest.php index 72fe47baf4..b76e5b4f03 100644 --- a/test/classes/Database/Designer/CommonTest.php +++ b/test/classes/Database/Designer/CommonTest.php @@ -40,9 +40,9 @@ class CommonTest extends TestCase 'db' => 'pmadb', 'pdf_pages' => 'pdf_pages', 'pdfwork' => true, - 'table_coords' => 'table_coords' - ] - ] + 'table_coords' => 'table_coords', + ], + ], ]; } diff --git a/test/classes/Database/DesignerTest.php b/test/classes/Database/DesignerTest.php index db738c74d5..47e4c3b4e9 100644 --- a/test/classes/Database/DesignerTest.php +++ b/test/classes/Database/DesignerTest.php @@ -34,7 +34,10 @@ class DesignerTest extends TestCase { $GLOBALS['server'] = 1; $GLOBALS['cfg']['ServerDefault'] = 1; - $GLOBALS['cfg']['PDFPageSizes'] = ['A3', 'A4']; + $GLOBALS['cfg']['PDFPageSizes'] = [ + 'A3', + 'A4', + ]; $GLOBALS['cfg']['PDFDefaultPageSize'] = 'A4'; $GLOBALS['cfg']['Schema']['pdf_orientation'] = 'L'; $GLOBALS['cfg']['Schema']['pdf_paper'] = 'A4'; @@ -46,9 +49,9 @@ class DesignerTest extends TestCase 'db' => 'pmadb', 'pdf_pages' => 'pdf_pages', 'pdfwork' => true - ] + ], ], - ' PMA_token ' => 'token' + ' PMA_token ' => 'token', ]; } @@ -79,8 +82,14 @@ class DesignerTest extends TestCase $dbi->expects($this->exactly(3)) ->method('fetchAssoc') ->willReturnOnConsecutiveCalls( - ['page_nr' => '1', 'page_descr' => 'page1'], - ['page_nr' => '2', 'page_descr' => 'page2'], + [ + 'page_nr' => '1', + 'page_descr' => 'page1', + ], + [ + 'page_nr' => '2', + 'page_descr' => 'page2', + ], false ); @@ -110,7 +119,7 @@ class DesignerTest extends TestCase $this->assertEquals( [ '1' => 'page1', - '2' => 'page2' + '2' => 'page2', ], $result ); diff --git a/test/classes/Database/QbeTest.php b/test/classes/Database/QbeTest.php index 00a351c889..cdb3acd9ed 100644 --- a/test/classes/Database/QbeTest.php +++ b/test/classes/Database/QbeTest.php @@ -116,7 +116,10 @@ class QbeTest extends PmaTestCase 'value="ASC" selected="selected">', $this->_callProtectedFunction( '_getSortSelectCell', - [1, 'ASC'] + [ + 1, + 'ASC', + ] ) ); } @@ -333,7 +336,13 @@ class QbeTest extends PmaTestCase . 'value="or" checked="checked"></td></tr></table></td>', $this->_callProtectedFunction( '_getInsDelAndOrCell', - [3, ['and' => '', 'or' => ' checked="checked"']] + [ + 3, + [ + 'and' => '', + 'or' => ' checked="checked"' + ], + ] ) ); } @@ -384,7 +393,10 @@ class QbeTest extends PmaTestCase . '"textfield" style="width: 12ex" size="20"></td></tr>', $this->_callProtectedFunction( '_getInsDelAndOrCriteriaRows', - [2,3] + [ + 2, + 3, + ] ) ); } @@ -452,9 +464,16 @@ class QbeTest extends PmaTestCase $this->_callProtectedFunction( '_getIndexes', [ - ['`table1`','table2'], - ['column1', 'column2', 'column3'], - ['column2'] + [ + '`table1`', + 'table2', + ], + [ + 'column1', + 'column2', + 'column3', + ], + ['column2'], ] ) ); @@ -469,14 +488,21 @@ class QbeTest extends PmaTestCase { $this->assertEquals( [ - 0 => 'column2' + 0 => 'column2', ], $this->_callProtectedFunction( '_getLeftJoinColumnCandidates', [ - ['`table1`','table2'], - ['column1', 'column2', 'column3'], - ['column2'] + [ + '`table1`', + 'table2', + ], + [ + 'column1', + 'column2', + 'column3', + ], + ['column2'], ] ) ); @@ -494,10 +520,17 @@ class QbeTest extends PmaTestCase $this->_callProtectedFunction( '_getMasterTable', [ - ['table1','table2'], - ['column1', 'column2', 'column3'], + [ + 'table1', + 'table2', + ], + [ + 'column1', + 'column2', + 'column3', + ], ['column2'], - ['qbe_test'] + ['qbe_test'], ] ) ); @@ -514,12 +547,12 @@ class QbeTest extends PmaTestCase 'table1.id', 'table1.value', 'table1.name', - 'table1.deleted' + 'table1.deleted', ]; $this->assertEquals( [ 'where_clause_tables' => [], - 'where_clause_columns' => [] + 'where_clause_columns' => [], ], $this->_callProtectedFunction( '_getWhereClauseTablesAndColumns', @@ -539,7 +572,7 @@ class QbeTest extends PmaTestCase 'table1.id', 'table1.value', 'table1.name', - 'table1.deleted' + 'table1.deleted', ]; $this->assertEquals( '`table1`', @@ -561,7 +594,7 @@ class QbeTest extends PmaTestCase 'table1.id', 'table1.value', 'table1.name', - 'table1.deleted' + 'table1.deleted', ]; $this->assertEquals( 'FROM `table1` diff --git a/test/classes/Database/SearchTest.php b/test/classes/Database/SearchTest.php index 95feace23d..119e05aabe 100644 --- a/test/classes/Database/SearchTest.php +++ b/test/classes/Database/SearchTest.php @@ -121,23 +121,23 @@ class SearchTest extends PmaTestCase return [ [ '1', - " WHERE (CONVERT(`column1` USING utf8) LIKE '%search%' OR CONVERT(`column2` USING utf8) LIKE '%search%') OR (CONVERT(`column1` USING utf8) LIKE '%string%' OR CONVERT(`column2` USING utf8) LIKE '%string%')" + " WHERE (CONVERT(`column1` USING utf8) LIKE '%search%' OR CONVERT(`column2` USING utf8) LIKE '%search%') OR (CONVERT(`column1` USING utf8) LIKE '%string%' OR CONVERT(`column2` USING utf8) LIKE '%string%')", ], [ '2', - " WHERE (CONVERT(`column1` USING utf8) LIKE '%search%' OR CONVERT(`column2` USING utf8) LIKE '%search%') AND (CONVERT(`column1` USING utf8) LIKE '%string%' OR CONVERT(`column2` USING utf8) LIKE '%string%')" + " WHERE (CONVERT(`column1` USING utf8) LIKE '%search%' OR CONVERT(`column2` USING utf8) LIKE '%search%') AND (CONVERT(`column1` USING utf8) LIKE '%string%' OR CONVERT(`column2` USING utf8) LIKE '%string%')", ], [ '3', - " WHERE (CONVERT(`column1` USING utf8) LIKE '%search string%' OR CONVERT(`column2` USING utf8) LIKE '%search string%')" + " WHERE (CONVERT(`column1` USING utf8) LIKE '%search string%' OR CONVERT(`column2` USING utf8) LIKE '%search string%')", ], [ '4', - " WHERE (CONVERT(`column1` USING utf8) LIKE 'search string' OR CONVERT(`column2` USING utf8) LIKE 'search string')" + " WHERE (CONVERT(`column1` USING utf8) LIKE 'search string' OR CONVERT(`column2` USING utf8) LIKE 'search string')", ], [ '5', - " WHERE (CONVERT(`column1` USING utf8) REGEXP 'search string' OR CONVERT(`column2` USING utf8) REGEXP 'search string')" + " WHERE (CONVERT(`column1` USING utf8) REGEXP 'search string' OR CONVERT(`column2` USING utf8) REGEXP 'search string')", ], ]; } diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php index df1675f94a..941fdb7034 100644 --- a/test/classes/DatabaseInterfaceTest.php +++ b/test/classes/DatabaseInterfaceTest.php @@ -77,9 +77,30 @@ class DatabaseInterfaceTest extends PmaTestCase public function currentUserData() { return [ - [[['pma@localhost']], 'pma@localhost', ['pma', 'localhost']], - [[['@localhost']], '@localhost', ['', 'localhost']], - [false, '@', ['', '']], + [ + [['pma@localhost']], + 'pma@localhost', + [ + 'pma', + 'localhost', + ], + ], + [ + [['@localhost']], + '@localhost', + [ + '', + 'localhost', + ], + ], + [ + false, + '@', + [ + '', + '', + ], + ], ]; } @@ -112,7 +133,8 @@ class DatabaseInterfaceTest extends PmaTestCase ->will( $this->returnValue( [ - $meta1, $meta2 + $meta1, + $meta2, ] ) ); @@ -121,7 +143,8 @@ class DatabaseInterfaceTest extends PmaTestCase $sql_query = "PMA_sql_query"; $view_columns = [ - "view_columns1", "view_columns2" + "view_columns1", + "view_columns2", ]; $column_map = $dbi->getColumnMapFromSql( @@ -277,7 +300,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'compress' => false, 'controluser' => 'u2', 'controlpass' => 'p2', - ] + ], ], ], [ @@ -293,7 +316,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'port' => 0, 'ssl' => false, 'compress' => false, - ] + ], ], ], [ @@ -313,7 +336,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'compress' => false, 'controluser' => 'u2', 'controlpass' => 'p2', - ] + ], ], ], [ @@ -329,7 +352,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'port' => 0, 'ssl' => true, 'compress' => false, - ] + ], ], ], [ @@ -350,7 +373,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'controluser' => 'u2', 'controlpass' => 'p2', 'control_ssl' => true, - ] + ], ], ], [ @@ -366,7 +389,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'port' => 0, 'ssl' => true, 'compress' => false, - ] + ], ], ], ]; @@ -397,12 +420,36 @@ class DatabaseInterfaceTest extends PmaTestCase public function errorData() { return [ - [2002, 'msg', 'The server is not responding'], - [2003, 'msg', 'The server is not responding'], - [1698, 'msg', 'logout.php'], - [1005, 'msg', 'server_engines.php'], - [1005, 'errno: 13', 'Please check privileges'], - [-1, 'error message', 'error message'], + [ + 2002, + 'msg', + 'The server is not responding', + ], + [ + 2003, + 'msg', + 'The server is not responding', + ], + [ + 1698, + 'msg', + 'logout.php', + ], + [ + 1005, + 'msg', + 'server_engines.php', + ], + [ + 1005, + 'errno: 13', + 'Please check privileges', + ], + [ + -1, + 'error message', + 'error message', + ], ]; } @@ -439,10 +486,22 @@ class DatabaseInterfaceTest extends PmaTestCase public function isAmazonRdsData() { return [ - [[['/usr']], false], - [[['E:/mysql']], false], - [[['/rdsdbbin/mysql/']], true], - [[['/rdsdbbin/mysql-5.7.18/']], true], + [ + [['/usr']], + false, + ], + [ + [['E:/mysql']], + false, + ], + [ + [['/rdsdbbin/mysql/']], + true, + ], + [ + [['/rdsdbbin/mysql-5.7.18/']], + true, + ], ]; } @@ -472,10 +531,30 @@ class DatabaseInterfaceTest extends PmaTestCase public function versionData() { return [ - ['5.0.5', 50005, 5, true], - ['5.05.01', 50501, 5, false], - ['5.6.35', 50635, 5, false], - ['10.1.22-MariaDB-', 100122, 10, false], + [ + '5.0.5', + 50005, + 5, + true, + ], + [ + '5.05.01', + 50501, + 5, + false, + ], + [ + '5.6.35', + 50635, + 5, + false, + ], + [ + '10.1.22-MariaDB-', + 100122, + 10, + false, + ], ]; } @@ -532,7 +611,7 @@ class DatabaseInterfaceTest extends PmaTestCase 'COLUMN_NAME' => 'idtable2', 'REFERENCED_TABLE_NAME' => 'table1', 'REFERENCED_COLUMN_NAME' => 'idtable1', - ] + ], ], $this->_dbi->getForeignKeyConstrains('test', ['table1', 'table2'])); } } diff --git a/test/classes/Dbi/DbiDummyTest.php b/test/classes/Dbi/DbiDummyTest.php index 2f2e009e69..b20e82c31e 100644 --- a/test/classes/Dbi/DbiDummyTest.php +++ b/test/classes/Dbi/DbiDummyTest.php @@ -78,8 +78,14 @@ class DbiDummyTest extends TestCase public function schemaData() { return [ - ['information_schema', true], - ['pma_test', false], + [ + 'information_schema', + true, + ], + [ + 'pma_test', + false, + ], ]; } @@ -111,12 +117,21 @@ class DbiDummyTest extends TestCase public function errorData() { return [ - [1234, '', '#1234 - '], - [1234, 'foobar', '#1234 - foobar'], [ - 2002, 'foobar', + 1234, + '', + '#1234 - ', + ], + [ + 1234, + 'foobar', + '#1234 - foobar', + ], + [ + 2002, + 'foobar', '#2002 - foobar — The server is not responding (or the local ' - . 'server\'s socket is not correctly configured).' + . 'server\'s socket is not correctly configured).', ], ]; } diff --git a/test/classes/Display/ExportTest.php b/test/classes/Display/ExportTest.php index 5d5997a72c..04838e25ec 100644 --- a/test/classes/Display/ExportTest.php +++ b/test/classes/Display/ExportTest.php @@ -137,11 +137,11 @@ class ExportTest extends TestCase $columns_info = [ 'test_column1' => [ - 'COLUMN_NAME' => 'test_column1' + 'COLUMN_NAME' => 'test_column1', ], 'test_column2' => [ - 'COLUMN_NAME' => 'test_column2' - ] + 'COLUMN_NAME' => 'test_column2', + ], ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() @@ -273,13 +273,13 @@ class ExportTest extends TestCase 'test\'_db' => [ 'test_<b>table' => [ 'co"l1' => [ - 'COLUMN_NAME' => 'co"l1' + 'COLUMN_NAME' => 'co"l1', ], 'col<2' => [ - 'COLUMN_NAME' => 'col<2' - ] - ] - ] + 'COLUMN_NAME' => 'col<2', + ], + ], + ], ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index 4da0866edf..ba19e77582 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -131,7 +131,13 @@ class ResultsTest extends PmaTestCase $actual = $this->_callPrivateFunction( '_getTableNavigationButton', - [&$caption, $title, $pos, $html_sql_query, true] + [ + &$caption, + $title, + $pos, + $html_sql_query, + true, + ] ); $this->assertContains( @@ -165,7 +171,7 @@ class ResultsTest extends PmaTestCase 'Submit', 1, 'SELECT * FROM `pma_bookmark` WHERE 1', - ] + ], ]; } @@ -181,8 +187,8 @@ class ResultsTest extends PmaTestCase 21, 41, false, - '310' - ] + '310', + ], ]; } @@ -200,8 +206,8 @@ class ResultsTest extends PmaTestCase '', '', '', - 'data grid_edit not_null ' - ] + 'data grid_edit not_null ', + ], ]; } @@ -235,8 +241,11 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getClassesForColumn', [ - $grid_edit_class, $not_null_class, $relation_class, - $hide_class, $field_type_class + $grid_edit_class, + $not_null_class, + $relation_class, + $hide_class, + $field_type_class, ] ) ); @@ -299,7 +308,10 @@ class ResultsTest extends PmaTestCase { $_SESSION['tmpval']['max_rows'] = DisplayResults::ALL_ROWS; $this->assertEquals( - [0, 0], + [ + 0, + 0, + ], $this->_callPrivateFunction('_getOffsets', []) ); } @@ -314,7 +326,10 @@ class ResultsTest extends PmaTestCase $_SESSION['tmpval']['max_rows'] = 5; $_SESSION['tmpval']['pos'] = 4; $this->assertEquals( - [9, 0], + [ + 9, + 0, + ], $this->_callPrivateFunction('_getOffsets', []) ); } @@ -341,7 +356,7 @@ class ResultsTest extends PmaTestCase 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ], 0, '%60new%60.%60id%60+%3D+1', @@ -353,8 +368,8 @@ class ResultsTest extends PmaTestCase . '"rows_to_delete[0]" class="multi_checkbox checkall" value="%60' . 'new%60.%60id%60+%3D+1"><input type="hidden" class="condition_' . 'array" value="{"`new`.`id`":"= 1"}"> ' - . '</td>' - ] + . '</td>', + ], ]; } @@ -390,8 +405,13 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getCheckboxForMultiRowSubmissions', [ - $del_url, $displayParts, $row_no, $where_clause_html, - $condition_array, $id_suffix, $class + $del_url, + $displayParts, + $row_no, + $where_clause_html, + $condition_array, + $id_suffix, + $class, ] ) ); @@ -424,8 +444,8 @@ class ResultsTest extends PmaTestCase . '><span class="nowrap"><img src="themes/dot.gif" title="Edit" ' . 'alt="Edit" class="icon ic_b_edit"> Edit</span></a>' . '<input type="hidden" class="where_clause" value ="%60customer' - . '%60.%60id%60+%3D+1"></span></td>' - ] + . '%60.%60id%60+%3D+1"></span></td>', + ], ]; } @@ -459,7 +479,11 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getEditLink', [ - $edit_url, $class, $edit_str, $where_clause, $where_clause_html + $edit_url, + $class, + $edit_str, + $where_clause, + $where_clause_html, ] ) ); @@ -492,8 +516,8 @@ class ResultsTest extends PmaTestCase . '><span class="nowrap"><img src="themes/dot.gif" title="Copy" ' . 'alt="Copy" class="icon ic_b_insrow"> Copy</span></a>' . '<input type="hidden" class="where_clause" value="%60customer%60' - . '.%60id%60+%3D+1"></span></td>' - ] + . '.%60id%60+%3D+1"></span></td>', + ], ]; } @@ -527,7 +551,11 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getCopyLink', [ - $copy_url, $copy_str, $where_clause, $where_clause_html, $class + $copy_url, + $copy_str, + $where_clause, + $where_clause_html, + $class, ] ) ); @@ -563,8 +591,8 @@ class ResultsTest extends PmaTestCase . 'gif" title="Delete" alt="Delete" class="icon ic_b_drop"> ' . 'Delete</span></a>' . '<div class="hide">DELETE FROM `Data`.`customer` WHERE ' - . '`customer`.`id` = 1</div></td>' - ] + . '`customer`.`id` = 1</div></td>', + ], ]; } @@ -596,7 +624,10 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getDeleteLink', [ - $del_url, $del_str, $js_conf, $class + $del_url, + $del_str, + $js_conf, + $class, ] ) ); @@ -625,7 +656,7 @@ class ResultsTest extends PmaTestCase 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ], 0, '`new`.`id` = 1', @@ -680,7 +711,7 @@ class ResultsTest extends PmaTestCase . 'gif" title="Delete" alt="Delete" class="icon ic_b_drop"> ' . 'Delete</span></a>' . '<div class="hide">DELETE FROM `data`.`new` WHERE `new`.`id` = 1' - . '</div></td>' + . '</div></td>', ], [ DisplayResults::POSITION_RIGHT, @@ -697,7 +728,7 @@ class ResultsTest extends PmaTestCase 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ], 0, '`new`.`id` = 1', @@ -750,7 +781,7 @@ class ResultsTest extends PmaTestCase . '"checkbox" id="id_rows_to_delete0_right" name="rows_to_delete' . '[0]" class="multi_checkbox checkall" value="%60new%60.%60id%60' . '+%3D+1"><input type="hidden" class="condition_array" value="' - . '{"`new`.`id`":"= 1"}"> </td>' + . '{"`new`.`id`":"= 1"}"> </td>', ], [ DisplayResults::POSITION_NONE, @@ -767,7 +798,7 @@ class ResultsTest extends PmaTestCase 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ], 0, '`new`.`id` = 1', @@ -793,7 +824,7 @@ class ResultsTest extends PmaTestCase . 'delete0_left" name="rows_to_delete[0]" class="multi_checkbox ' . 'checkall" value="%60new%60.%60id%60+%3D+1"><input type=' . '"hidden" class="condition_array" value="{"`new`.`id`":' - . '"= 1"}"> </td>' + . '"= 1"}"> </td>', ], ]; } @@ -844,10 +875,20 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getCheckboxAndLinks', [ - $position, $del_url, $displayParts, $row_no, $where_clause, - $where_clause_html, $condition_array, - $edit_url, $copy_url, $class, $edit_str, - $copy_str, $del_str, $js_conf + $position, + $del_url, + $displayParts, + $row_no, + $where_clause, + $where_clause_html, + $condition_array, + $edit_url, + $copy_url, + $class, + $edit_str, + $copy_str, + $del_str, + $js_conf, ] ) ); @@ -876,7 +917,7 @@ class ResultsTest extends PmaTestCase 'nav_bar' => '1', 'bkm_form' => '1', 'text_btn' => '1', - 'pview_lnk' => '1' + 'pview_lnk' => '1', ], 0, '`new`.`id` = 1', @@ -902,8 +943,8 @@ class ResultsTest extends PmaTestCase . 'delete0_left" name="rows_to_delete[0]" class="multi_checkbox ' . 'checkall" value="%60new%60.%60id%60+%3D+1"><input type=' . '"hidden" class="condition_array" value="{"`new`.`id`":' - . '"= 1"}"> </td>' - ] + . '"= 1"}"> </td>', + ], ]; } @@ -952,10 +993,20 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getPlacedLinks', [ - $dir, $del_url, $displayParts, $row_no, $where_clause, - $where_clause_html, $condition_array, - $edit_url, $copy_url, $edit_anchor_class, - $edit_str, $copy_str, $del_str, $js_conf + $dir, + $del_url, + $displayParts, + $row_no, + $where_clause, + $where_clause_html, + $condition_array, + $edit_url, + $copy_url, + $edit_anchor_class, + $edit_str, + $copy_str, + $del_str, + $js_conf, ] ) ); @@ -981,7 +1032,7 @@ class ResultsTest extends PmaTestCase ], 'routine_name', 'db_routines.php?item_name=circumference&db=data' - . '&item_type=FUNCTION&server=0&lang=en' + . '&item_type=FUNCTION&server=0&lang=en', ], [ 'information_schema', @@ -994,7 +1045,7 @@ class ResultsTest extends PmaTestCase ], 'routine_name', 'db_routines.php?item_name=area&db=data' - . '&item_type=PROCEDURE&server=0&lang=en' + . '&item_type=PROCEDURE&server=0&lang=en', ], [ 'information_schema', @@ -1007,8 +1058,8 @@ class ResultsTest extends PmaTestCase 'column_name', 'index.php?sql_query=SELECT+%60CHARACTER_SET_NAME%60+FROM+%60info' . 'rmation_schema%60.%60CHARACTER_SETS%60&db=information_schema' - . '&test_name=value&server=0&lang=en' - ] + . '&test_name=value&server=0&lang=en', + ], ]; } @@ -1043,36 +1094,39 @@ class ResultsTest extends PmaTestCase 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'routine_schema' + 'column_name' => 'routine_schema', ], 1 => [ 'param_info' => 'item_type', - 'column_name' => 'routine_type' - ] + 'column_name' => 'routine_type', + ], ], 'default_page' => 'db_routines.php' - ] + ], ], 'columns' => [ 'column_name' => [ 'link_param' => [ 'sql_query', 'table_schema', - 'table_name' + 'table_name', ], 'link_dependancy_params' => [ 0 => [ 'param_info' => 'db', - 'column_name' => 'table_schema' + 'column_name' => 'table_schema', ], 1 => [ - 'param_info' => ['test_name', 'value'] - ] + 'param_info' => [ + 'test_name', + 'value', + ], + ], ], 'default_page' => 'index.php' - ] + ], ] - ] + ], ]; $this->object->__set('db', $db); @@ -1082,7 +1136,11 @@ class ResultsTest extends PmaTestCase $output, $this->_callPrivateFunction( '_getSpecialLinkUrl', - [$column_value, $row_info, $field_name] + [ + $column_value, + $row_info, + $field_name, + ] ) ); } @@ -1095,7 +1153,12 @@ class ResultsTest extends PmaTestCase */ public function dataProviderForTestGetRowInfoForSpecialLinks() { - $column_names = ['host', 'db', 'user', 'select_privilages']; + $column_names = [ + 'host', + 'db', + 'user', + 'select_privilages', + ]; $fields_mata = []; foreach ($column_names as $column_name) { @@ -1112,21 +1175,21 @@ class ResultsTest extends PmaTestCase 0 => 'localhost', 1 => 'phpmyadmin', 2 => 'pmauser', - 3 => 'Y' + 3 => 'Y', ], [ 0 => '0', 1 => '3', 2 => '1', - 3 => '2' + 3 => '2', ], [ 'host' => 'localhost', 'select_privilages' => 'Y', 'db' => 'phpmyadmin', 'user' => 'pmauser' - ] - ] + ], + ], ]; } @@ -1158,7 +1221,10 @@ class ResultsTest extends PmaTestCase $output, $this->_callPrivateFunction( '_getRowInfoForSpecialLinks', - [$row, $col_order] + [ + $row, + $col_order, + ] ) ); } @@ -1191,8 +1257,8 @@ class ResultsTest extends PmaTestCase . '<input type="hidden" name="goto" value="tbl_structure.php">' . '<input type="checkbox" name="navig" id="showAll_0"' . ' class="showAllRows" value="all">' - . '<label for="showAll_0">Show all</label></form></td>' - ] + . '<label for="showAll_0">Show all</label></form></td>', + ], ]; } @@ -1226,7 +1292,10 @@ class ResultsTest extends PmaTestCase $result = $this->_callPrivateFunction( '_getShowAllCheckboxForTableNavigation', - [false, $html_sql_query] + [ + false, + $html_sql_query, + ] ); $this->assertContains( @@ -1307,10 +1376,46 @@ class ResultsTest extends PmaTestCase public function dataProviderForTestGetPartialText() { return [ - ['P', 10, 'foo', [false, 'foo', 3]], - ['P', 1, 'foo', [true, 'f...', 3]], - ['F', 10, 'foo', [false, 'foo', 3]], - ['F', 1, 'foo', [false, 'foo', 3]] + [ + 'P', + 10, + 'foo', + [ + false, + 'foo', + 3, + ], + ], + [ + 'P', + 1, + 'foo', + [ + true, + 'f...', + 3, + ], + ], + [ + 'F', + 10, + 'foo', + [ + false, + 'foo', + 3, + ], + ], + [ + 'F', + 1, + 'foo', + [ + false, + 'foo', + 3, + ], + ], ]; } @@ -1352,7 +1457,10 @@ class ResultsTest extends PmaTestCase $meta = new stdClass(); $meta->type = 'BLOB'; $meta->orgtable = 'bar'; - $url_params = ['db' => 'foo', 'table' => 'bar']; + $url_params = [ + 'db' => 'foo', + 'table' => 'bar', + ]; return [ [ @@ -1360,45 +1468,63 @@ class ResultsTest extends PmaTestCase true, 'BLOB', '1001', - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], [], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], $meta, $url_params, null, '<a href="tbl_get_field.php?db=foo&table=bar&server=0' . '&lang=en' - . '" class="disableAjax">1001</a>' + . '" class="disableAjax">1001</a>', ], [ true, true, 'BLOB', hex2bin('123456'), - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], [], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], $meta, $url_params, null, '<a href="tbl_get_field.php?db=foo&table=bar&server=0' . '&lang=en' - . '" class="disableAjax">0x123456</a>' + . '" class="disableAjax">0x123456</a>', ], [ true, false, 'BLOB', '1001', - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], [], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], $meta, $url_params, null, '<a href="tbl_get_field.php?db=foo&table=bar&server=0' . '&lang=en' - . '" class="disableAjax">[BLOB - 4 B]</a>' + . '" class="disableAjax">[BLOB - 4 B]</a>', ], [ false, @@ -1407,11 +1533,14 @@ class ResultsTest extends PmaTestCase '1001', $transformation_plugin, [], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], $meta, $url_params, null, - '1001' + '1001', ], [ false, @@ -1420,12 +1549,15 @@ class ResultsTest extends PmaTestCase null, '', [], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], $meta, $url_params, null, - '[GEOMETRY - NULL]' - ] + '[GEOMETRY - NULL]', + ], ]; } @@ -1473,9 +1605,14 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_handleNonPrintableContents', [ - $category, $content, $transformation_plugin, - $transform_options, $default_function, - $meta, $url_params, &$is_truncated + $category, + $content, + $transformation_plugin, + $transform_options, + $default_function, + $meta, + $url_params, + &$is_truncated, ] ) ); @@ -1508,7 +1645,10 @@ class ResultsTest extends PmaTestCase $meta2->decimals = 0; $meta2->name = 'varchar'; $meta2->orgname = 'varchar'; - $url_params = ['db' => 'foo', 'table' => 'tbl']; + $url_params = [ + 'db' => 'foo', + 'table' => 'tbl', + ]; return [ [ @@ -1519,8 +1659,14 @@ class ResultsTest extends PmaTestCase [], $url_params, false, - [Core::class, 'mimeDefaultFunction'], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], + [ + Core::class, + 'mimeDefaultFunction', + ], ['https://www.example.com/'], false, [], @@ -1531,7 +1677,7 @@ class ResultsTest extends PmaTestCase . 'db=foo&table=tbl&server=0&lang=en' . '" ' . 'class="disableAjax">[BLOB - 4 B]</a>' . "\n" - . '</td>' . "\n" + . '</td>' . "\n", ], [ 'noblob', @@ -1542,7 +1688,10 @@ class ResultsTest extends PmaTestCase $url_params, false, $transformation_plugin, - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], [], false, [], @@ -1550,7 +1699,7 @@ class ResultsTest extends PmaTestCase 'binary', '<td class="left grid_edit transformed hex">' . "\n" . ' 1001' . "\n" - . '</td>' . "\n" + . '</td>' . "\n", ], [ 'noblob', @@ -1561,7 +1710,10 @@ class ResultsTest extends PmaTestCase $url_params, false, $transformation_plugin, - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], [], false, [], @@ -1572,7 +1724,7 @@ class ResultsTest extends PmaTestCase . ' data-type="string"' . "\n" . ' class="grid_edit null">' . "\n" . ' <em>NULL</em>' . "\n" - . '</td>' . "\n" + . '</td>' . "\n", ], [ 'all', @@ -1582,8 +1734,14 @@ class ResultsTest extends PmaTestCase [], $url_params, false, - [Core::class, 'mimeDefaultFunction'], - [Core::class, 'mimeDefaultFunction'], + [ + Core::class, + 'mimeDefaultFunction', + ], + [ + Core::class, + 'mimeDefaultFunction', + ], [], false, [], @@ -1591,8 +1749,8 @@ class ResultsTest extends PmaTestCase 0, '<td data-decimals="0" data-type="string" ' . 'data-originallength="11" ' - . 'class="grid_edit ">foo bar baz</td>' . "\n" - ] + . 'class="grid_edit ">foo bar baz</td>' . "\n", + ], ]; } @@ -1649,9 +1807,19 @@ class ResultsTest extends PmaTestCase $this->_callPrivateFunction( '_getDataCellForNonNumericColumns', [ - $column, $class, $meta, $map, $_url_params, $condition_field, - $transformation_plugin, $default_function, $transform_options, - $is_field_truncated, $analyzed_sql_results, &$dt_result, $col_index + $column, + $class, + $meta, + $map, + $_url_params, + $condition_field, + $transformation_plugin, + $default_function, + $transform_options, + $is_field_truncated, + $analyzed_sql_results, + &$dt_result, + $col_index, ] ) ); @@ -1705,7 +1873,10 @@ class ResultsTest extends PmaTestCase $meta2->numeric = true; $meta2->primary_key = false; $meta2->unique_key = false; - $fields_meta = [$meta, $meta2]; + $fields_meta = [ + $meta, + $meta2, + ]; $this->object->__set('fields_meta', $fields_meta); // MIME transformations @@ -1734,9 +1905,18 @@ class ResultsTest extends PmaTestCase $output = $this->_callPrivateFunction( '_getRowValues', [ - &$result, [3600, true], 0, false, [], - '', false, $query, - Query::getAll($query) + &$result, + [ + 3600, + true, + ], + 0, + false, + [], + '', + false, + $query, + Query::getAll($query), ] ); diff --git a/test/classes/Engines/BdbTest.php b/test/classes/Engines/BdbTest.php index d21e4bfd0b..e9c1eff773 100644 --- a/test/classes/Engines/BdbTest.php +++ b/test/classes/Engines/BdbTest.php @@ -64,34 +64,23 @@ class BdbTest extends PmaTestCase 'bdb_cache_size' => [ 'type' => 1, ], - 'bdb_home' => [ - ], + 'bdb_home' => [], 'bdb_log_buffer_size' => [ 'type' => 1, ], - 'bdb_logdir' => [ - ], + 'bdb_logdir' => [], 'bdb_max_lock' => [ 'type' => 2, ], - 'bdb_shared_data' => [ - ], - 'bdb_tmpdir' => [ - ], - 'bdb_data_direct' => [ - ], - 'bdb_lock_detect' => [ - ], - 'bdb_log_direct' => [ - ], - 'bdb_no_recover' => [ - ], - 'bdb_no_sync' => [ - ], - 'skip_sync_bdb_logs' => [ - ], - 'sync_bdb_logs' => [ - ], + 'bdb_shared_data' => [], + 'bdb_tmpdir' => [], + 'bdb_data_direct' => [], + 'bdb_lock_detect' => [], + 'bdb_log_direct' => [], + 'bdb_no_recover' => [], + 'bdb_no_sync' => [], + 'skip_sync_bdb_logs' => [], + 'sync_bdb_logs' => [], ] ); } diff --git a/test/classes/Engines/InnodbTest.php b/test/classes/Engines/InnodbTest.php index 9f0f42348f..f1755b1f1b 100644 --- a/test/classes/Engines/InnodbTest.php +++ b/test/classes/Engines/InnodbTest.php @@ -81,37 +81,26 @@ class InnodbTest extends PmaTestCase 'innodb_buffer_pool_awe_mem_mb' => [ 'type' => 1, ], - 'innodb_checksums' => [ - ], - 'innodb_commit_concurrency' => [ - ], + 'innodb_checksums' => [], + 'innodb_commit_concurrency' => [], 'innodb_concurrency_tickets' => [ 'type' => 2, ], - 'innodb_doublewrite' => [ - ], - 'innodb_fast_shutdown' => [ - ], + 'innodb_doublewrite' => [], + 'innodb_fast_shutdown' => [], 'innodb_file_io_threads' => [ 'type' => 2, ], - 'innodb_file_per_table' => [ - ], - 'innodb_flush_log_at_trx_commit' => [ - ], - 'innodb_flush_method' => [ - ], - 'innodb_force_recovery' => [ - ], + 'innodb_file_per_table' => [], + 'innodb_flush_log_at_trx_commit' => [], + 'innodb_flush_method' => [], + 'innodb_force_recovery' => [], 'innodb_lock_wait_timeout' => [ 'type' => 2, ], - 'innodb_locks_unsafe_for_binlog' => [ - ], - 'innodb_log_arch_dir' => [ - ], - 'innodb_log_archive' => [ - ], + 'innodb_locks_unsafe_for_binlog' => [], + 'innodb_log_arch_dir' => [], + 'innodb_log_archive' => [], 'innodb_log_buffer_size' => [ 'type' => 1, ], @@ -121,21 +110,18 @@ class InnodbTest extends PmaTestCase 'innodb_log_files_in_group' => [ 'type' => 2, ], - 'innodb_log_group_home_dir' => [ - ], + 'innodb_log_group_home_dir' => [], 'innodb_max_dirty_pages_pct' => [ 'type' => 2, ], - 'innodb_max_purge_lag' => [ - ], + 'innodb_max_purge_lag' => [], 'innodb_mirrored_log_groups' => [ 'type' => 2, ], 'innodb_open_files' => [ 'type' => 2, ], - 'innodb_support_xa' => [ - ], + 'innodb_support_xa' => [], 'innodb_sync_spin_loops' => [ 'type' => 2, ], diff --git a/test/classes/Engines/MemoryTest.php b/test/classes/Engines/MemoryTest.php index c1a1e45ef7..28006718be 100644 --- a/test/classes/Engines/MemoryTest.php +++ b/test/classes/Engines/MemoryTest.php @@ -60,7 +60,7 @@ class MemoryTest extends PmaTestCase [ 'max_heap_table_size' => [ 'type' => 1, - ] + ], ] ); } diff --git a/test/classes/Engines/MyisamTest.php b/test/classes/Engines/MyisamTest.php index 13131d590c..78bed092fc 100644 --- a/test/classes/Engines/MyisamTest.php +++ b/test/classes/Engines/MyisamTest.php @@ -87,15 +87,12 @@ class MyisamTest extends PmaTestCase 'desc' => __('The buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE.'), 'type' => 1, ], - 'myisam_stats_method' => [ - ], - 'delay_key_write' => [ - ], + 'myisam_stats_method' => [], + 'delay_key_write' => [], 'bulk_insert_buffer_size' => [ 'type' => 1, ], - 'skip_external_locking' => [ - ], + 'skip_external_locking' => [], ] ); } diff --git a/test/classes/Engines/NdbclusterTest.php b/test/classes/Engines/NdbclusterTest.php index e3c0e7c67e..e2739e419f 100644 --- a/test/classes/Engines/NdbclusterTest.php +++ b/test/classes/Engines/NdbclusterTest.php @@ -58,8 +58,7 @@ class NdbclusterTest extends PmaTestCase $this->assertEquals( $this->object->getVariables(), [ - 'ndb_connectstring' => [ - ], + 'ndb_connectstring' => [], ] ); } diff --git a/test/classes/Engines/PbxtTest.php b/test/classes/Engines/PbxtTest.php index 212601bbd1..77bcb267da 100644 --- a/test/classes/Engines/PbxtTest.php +++ b/test/classes/Engines/PbxtTest.php @@ -67,7 +67,7 @@ class PbxtTest extends PmaTestCase . ' index cache. Default value is 32MB. The memory' . ' allocated here is used only for caching index pages.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_record_cache_size' => [ 'title' => __('Record cache size'), @@ -77,7 +77,7 @@ class PbxtTest extends PmaTestCase . ' value is 32MB. This memory is used to cache changes to' . ' the handle data (.xtd) and row pointer (.xtr) files.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_log_cache_size' => [ 'title' => __('Log cache size'), @@ -86,7 +86,7 @@ class PbxtTest extends PmaTestCase . ' transaction log cache used to cache on transaction log' . ' data. The default is 16MB.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_log_file_threshold' => [ 'title' => __('Log file threshold'), @@ -94,7 +94,7 @@ class PbxtTest extends PmaTestCase 'The size of a transaction log before rollover,' . ' and a new log is created. The default value is 16MB.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_transaction_buffer_size' => [ 'title' => __('Transaction buffer size'), @@ -103,7 +103,7 @@ class PbxtTest extends PmaTestCase . ' (the engine allocates 2 buffers of this size).' . ' The default is 1MB.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_checkpoint_frequency' => [ 'title' => __('Checkpoint frequency'), @@ -112,7 +112,7 @@ class PbxtTest extends PmaTestCase . ' log before a checkpoint is performed.' . ' The default value is 24MB.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_data_log_threshold' => [ 'title' => __('Data log threshold'), @@ -123,7 +123,7 @@ class PbxtTest extends PmaTestCase . ' this variable can be increased to increase the total' . ' amount of data that can be stored in the database.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_garbage_threshold' => [ 'title' => __('Garbage threshold'), @@ -132,7 +132,7 @@ class PbxtTest extends PmaTestCase . ' before it is compacted. This is a value between 1 and' . ' 99. The default is 50.' ), - 'type' => 2 + 'type' => 2, ], 'pbxt_log_buffer_size' => [ 'title' => __('Log buffer size'), @@ -142,17 +142,17 @@ class PbxtTest extends PmaTestCase . ' buffer per thread, but only if the thread is required' . ' to write a data log.' ), - 'type' => 1 + 'type' => 1, ], 'pbxt_data_file_grow_size' => [ 'title' => __('Data file grow size'), 'desc' => __('The grow size of the handle data (.xtd) files.'), - 'type' => 1 + 'type' => 1, ], 'pbxt_row_file_grow_size' => [ 'title' => __('Row file grow size'), 'desc' => __('The grow size of the row pointer (.xtr) files.'), - 'type' => 1 + 'type' => 1, ], 'pbxt_log_file_count' => [ 'title' => __('Log file count'), @@ -163,7 +163,7 @@ class PbxtTest extends PmaTestCase . ' deleted, otherwise they are renamed and given the next' . ' highest number.' ), - 'type' => 2 + 'type' => 2, ], ] ); @@ -199,23 +199,23 @@ class PbxtTest extends PmaTestCase '8MB', [ 0 => '8,192', - 1 => 'KiB' - ] + 1 => 'KiB', + ], ], [ '10mb', [ 0 => '-1', - 1 => 'B' - ] + 1 => 'B', + ], ], [ 'A4', [ 0 => '0', - 1 => 'B' - ] - ] + 1 => 'B', + ], + ], ]; } @@ -229,7 +229,7 @@ class PbxtTest extends PmaTestCase $this->assertEquals( $this->object->getInfoPages(), [ - 'Documentation' => 'Documentation' + 'Documentation' => 'Documentation', ] ); } diff --git a/test/classes/ErrorHandlerTest.php b/test/classes/ErrorHandlerTest.php index 1be8373592..714b641dd0 100644 --- a/test/classes/ErrorHandlerTest.php +++ b/test/classes/ErrorHandlerTest.php @@ -87,7 +87,7 @@ class ErrorHandlerTest extends PmaTestCase 12, 'User notice', 'User notice', - ] + ], ]; } diff --git a/test/classes/ErrorReportTest.php b/test/classes/ErrorReportTest.php index 4b11f94988..93b4930189 100644 --- a/test/classes/ErrorReportTest.php +++ b/test/classes/ErrorReportTest.php @@ -151,7 +151,10 @@ class ErrorReportTest extends TestCase $form = $this->errorReport->getForm(); $this->assertContains('<pre class="report-data">[]</pre>', $form); - $_POST['exception'] = ['stack' => [], 'url' => 'http://localhost/index.php']; + $_POST['exception'] = [ + 'stack' => [], + 'url' => 'http://localhost/index.php' + ]; $_POST['microhistory'] = ''; $_POST['description'] = 'description'; @@ -166,7 +169,10 @@ class ErrorReportTest extends TestCase 'configuration_storage' => 'disabled', 'php_version' => phpversion(), 'exception_type' => 'js', - 'exception' => ['stack' => [], 'uri' => 'index.php?'], + 'exception' => [ + 'stack' => [], + 'uri' => 'index.php?' + ], 'script_name' => 'index.php', 'microhistory' => $_POST['microhistory'], 'steps' => $_POST['description'], diff --git a/test/classes/ErrorTest.php b/test/classes/ErrorTest.php index 64cf4e7875..004d8390d1 100644 --- a/test/classes/ErrorTest.php +++ b/test/classes/ErrorTest.php @@ -57,7 +57,14 @@ class ErrorTest extends PmaTestCase */ public function testSetBacktrace() { - $bt = [['file' => 'bt1','line' => 2, 'function' => 'bar', 'args' => ['foo' => $this]]]; + $bt = [ + [ + 'file' => 'bt1', + 'line' => 2, + 'function' => 'bar', + 'args' => ['foo' => $this] + ], + ]; $this->object->setBacktrace($bt); $bt[0]['args']['foo'] = '<Class:PhpMyAdmin\Tests\ErrorTest>'; $this->assertEquals($bt, $this->object->getBacktrace()); @@ -98,12 +105,18 @@ class ErrorTest extends PmaTestCase public function filePathProvider() { return [ - ['./ChangeLog', '.' . DIRECTORY_SEPARATOR . 'ChangeLog'], + [ + './ChangeLog', + '.' . DIRECTORY_SEPARATOR . 'ChangeLog', + ], [ __FILE__, - '.' . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'ErrorTest.php' + '.' . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'ErrorTest.php', + ], + [ + './NONEXISTING', + 'NONEXISTING', ], - ['./NONEXISTING', 'NONEXISTING'], ]; } @@ -174,10 +187,30 @@ class ErrorTest extends PmaTestCase public function testGetBacktrace() { $bt = [ - ['file' => 'bt1','line' => 2, 'function' => 'bar', 'args' => ['foo' => 1]], - ['file' => 'bt2','line' => 2, 'function' => 'bar', 'args' => ['foo' => 2]], - ['file' => 'bt3','line' => 2, 'function' => 'bar', 'args' => ['foo' => 3]], - ['file' => 'bt4','line' => 2, 'function' => 'bar', 'args' => ['foo' => 4]], + [ + 'file' => 'bt1', + 'line' => 2, + 'function' => 'bar', + 'args' => ['foo' => 1] + ], + [ + 'file' => 'bt2', + 'line' => 2, + 'function' => 'bar', + 'args' => ['foo' => 2] + ], + [ + 'file' => 'bt3', + 'line' => 2, + 'function' => 'bar', + 'args' => ['foo' => 3] + ], + [ + 'file' => 'bt4', + 'line' => 2, + 'function' => 'bar', + 'args' => ['foo' => 4] + ], ]; $this->object->setBacktrace($bt); diff --git a/test/classes/ExportTest.php b/test/classes/ExportTest.php index c72d7668fa..2f711144ad 100644 --- a/test/classes/ExportTest.php +++ b/test/classes/ExportTest.php @@ -52,18 +52,18 @@ class ExportTest extends TestCase 'alias' => 'foobar', 'columns' => [ 'bar' => 'foo', - 'baz' => 'barbaz' - ] + 'baz' => 'barbaz', + ], ], 'bar' => [ 'alias' => 'foobaz', 'columns' => [ 'a' => 'a_alias', - 'b' => 'b' - ] - ] - ] - ] + 'b' => 'b', + ], + ], + ], + ], ]; $aliases2 = [ 'test_db' => [ @@ -71,16 +71,16 @@ class ExportTest extends TestCase 'tables' => [ 'foo' => [ 'columns' => [ - 'bar' => 'foobar' - ] + 'bar' => 'foobar', + ], ], 'baz' => [ 'columns' => [ - 'a' => 'x' - ] - ] - ] - ] + 'a' => 'x', + ], + ], + ], + ], ]; $expected = [ 'test_db' => [ @@ -90,23 +90,23 @@ class ExportTest extends TestCase 'alias' => 'foobar', 'columns' => [ 'bar' => 'foobar', - 'baz' => 'barbaz' - ] + 'baz' => 'barbaz', + ], ], 'bar' => [ 'alias' => 'foobaz', 'columns' => [ 'a' => 'a_alias', - 'b' => 'b' - ] + 'b' => 'b', + ], ], 'baz' => [ 'columns' => [ - 'a' => 'x' - ] - ] - ] - ] + 'a' => 'x', + ], + ], + ], + ], ]; $actual = $this->export->mergeAliases($aliases1, $aliases2); $this->assertEquals($expected, $actual); diff --git a/test/classes/FileTest.php b/test/classes/FileTest.php index b443479763..44fff5acab 100644 --- a/test/classes/FileTest.php +++ b/test/classes/FileTest.php @@ -84,9 +84,18 @@ class FileTest extends PmaTestCase public function compressedFiles() { return [ - ['./test/test_data/test.gz', 'application/gzip'], - ['./test/test_data/test.bz2', 'application/bzip2'], - ['./test/test_data/test.zip', 'application/zip'], + [ + './test/test_data/test.gz', + 'application/gzip', + ], + [ + './test/test_data/test.bz2', + 'application/bzip2', + ], + [ + './test/test_data/test.zip', + 'application/zip', + ], ]; } } diff --git a/test/classes/FontTest.php b/test/classes/FontTest.php index 9fbb07db5d..fbb15d427b 100644 --- a/test/classes/FontTest.php +++ b/test/classes/FontTest.php @@ -264,7 +264,12 @@ class FontTest extends PmaTestCase "a", "arial", 10, - [["chars" => "a", "modifier" => 0.61]] + [ + [ + "chars" => "a", + "modifier" => 0.61, + ], + ] ) ); @@ -275,7 +280,12 @@ class FontTest extends PmaTestCase "a", "arial", 10, - [["chars" => ["a"], "modifier" => 0.61]] + [ + [ + "chars" => ["a"], + "modifier" => 0.61, + ], + ] ) ); } diff --git a/test/classes/Gis/GisFactoryTest.php b/test/classes/Gis/GisFactoryTest.php index d2ec0da951..6eae196036 100644 --- a/test/classes/Gis/GisFactoryTest.php +++ b/test/classes/Gis/GisFactoryTest.php @@ -44,31 +44,31 @@ class GisFactoryTest extends TestCase return [ [ 'MULTIPOLYGON', - 'PhpMyAdmin\Gis\GisMultiPolygon' + 'PhpMyAdmin\Gis\GisMultiPolygon', ], [ 'POLYGON', - 'PhpMyAdmin\Gis\GisPolygon' + 'PhpMyAdmin\Gis\GisPolygon', ], [ 'MULTILINESTRING', - 'PhpMyAdmin\Gis\GisMultiLineString' + 'PhpMyAdmin\Gis\GisMultiLineString', ], [ 'LINESTRING', - 'PhpMyAdmin\Gis\GisLineString' + 'PhpMyAdmin\Gis\GisLineString', ], [ 'MULTIPOINT', - 'PhpMyAdmin\Gis\GisMultiPoint' + 'PhpMyAdmin\Gis\GisMultiPoint', ], [ 'POINT', - 'PhpMyAdmin\Gis\GisPoint' + 'PhpMyAdmin\Gis\GisPoint', ], [ 'GEOMETRYCOLLECTION', - 'PhpMyAdmin\Gis\GisGeometryCollection' + 'PhpMyAdmin\Gis\GisGeometryCollection', ], ]; } diff --git a/test/classes/Gis/GisGeometryCollectionTest.php b/test/classes/Gis/GisGeometryCollectionTest.php index 29b9ea57ff..eef4c35c7c 100644 --- a/test/classes/Gis/GisGeometryCollectionTest.php +++ b/test/classes/Gis/GisGeometryCollectionTest.php @@ -79,9 +79,9 @@ class GisGeometryCollectionTest extends TestCase 'maxX' => 45.0, 'minX' => 10.0, 'maxY' => 45.0, - 'minY' => 10.0 - ] - ] + 'minY' => 10.0, + ], + ], ]; } @@ -117,10 +117,16 @@ class GisGeometryCollectionTest extends TestCase 'gis_type' => 'LINESTRING', 'LINESTRING' => [ 'no_of_points' => 2, - 0 => ['x' => 5.02, 'y' => 8.45], - 1 => ['x' => 6.14, 'y' => 0.15] - ] - ] + 0 => [ + 'x' => 5.02, + 'y' => 8.45, + ], + 1 => [ + 'x' => 6.14, + 'y' => 0.15, + ] + ], + ], ]; return [ @@ -128,8 +134,8 @@ class GisGeometryCollectionTest extends TestCase $temp1, 0, null, - 'GEOMETRYCOLLECTION(LINESTRING(5.02 8.45,6.14 0.15))' - ] + 'GEOMETRYCOLLECTION(LINESTRING(5.02 8.45,6.14 0.15))', + ], ]; } @@ -167,13 +173,13 @@ class GisGeometryCollectionTest extends TestCase 'no_of_points' => 2, '0' => [ 'x' => 5.02, - 'y' => 8.45 + 'y' => 8.45, ], '1' => [ 'x' => 6.14, - 'y' => 0.15 + 'y' => 0.15, ] - ] + ], ] ], ], @@ -231,10 +237,10 @@ class GisGeometryCollectionTest extends TestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], - imagecreatetruecolor(120, 150) - ] + imagecreatetruecolor(120, 150), + ], ]; } @@ -285,10 +291,10 @@ class GisGeometryCollectionTest extends TestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -347,13 +353,13 @@ class GisGeometryCollectionTest extends TestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], '/^(<path d=" M 46, 268 L -4, 248 L 6, 208 L 66, 198 Z M 16,' . ' 228 L 46, 224 L 36, 248 Z " name="svg" id="svg)(\d+)' . '(" class="polygon vector" stroke="black" stroke-width="0.5"' - . ' fill="#B02EE0" fill-rule="evenodd" fill-opacity="0.8"\/>)$/' - ] + . ' fill="#B02EE0" fill-rule="evenodd" fill-opacity="0.8"\/>)$/', + ], ]; } @@ -438,8 +444,8 @@ class GisGeometryCollectionTest extends TestCase . '.Point(20,30)).transform(new OpenLayers.Projection("EPSG:43' . '26"), map.getProjectionObject()))))), null, {"strokeColor":' . '"#000000","strokeWidth":0.5,"fillColor":"#B02EE0","fillOpac' - . 'ity":0.8,"label":"Ol","fontSize":10}));' - ] + . 'ity":0.8,"label":"Ol","fontSize":10}));', + ], ]; } } diff --git a/test/classes/Gis/GisGeometryTest.php b/test/classes/Gis/GisGeometryTest.php index d0ebd19354..e715ab9f96 100644 --- a/test/classes/Gis/GisGeometryTest.php +++ b/test/classes/Gis/GisGeometryTest.php @@ -80,7 +80,10 @@ class GisGeometryTest extends TestCase $output, $this->_callProtectedFunction( 'setMinMax', - [$point_set, $min_max] + [ + $point_set, + $min_max, + ] ) ); } @@ -100,8 +103,8 @@ class GisGeometryTest extends TestCase 'minX' => 12, 'maxX' => 69, 'minY' => 23, - 'maxY' => 78 - ] + 'maxY' => 78, + ], ], [ '12 35,48 75,69 23,25 45,14 53,35 78', @@ -109,15 +112,15 @@ class GisGeometryTest extends TestCase 'minX' => 2, 'maxX' => 29, 'minY' => 23, - 'maxY' => 128 + 'maxY' => 128, ], [ 'minX' => 2, 'maxX' => 69, 'minY' => 23, - 'maxY' => 128 - ] - ] + 'maxY' => 128, + ], + ], ]; } @@ -190,7 +193,11 @@ class GisGeometryTest extends TestCase $output, $this->_callProtectedFunction( 'extractPoints', - [$point_set, $scale_data, $linear] + [ + $point_set, + $scale_data, + $linear, + ] ) ); } @@ -209,9 +216,18 @@ class GisGeometryTest extends TestCase null, false, [ - 0 => [12, 35], - 1 => [48, 75], - 2 => [69, 23], + 0 => [ + 12, + 35, + ], + 1 => [ + 48, + 75, + ], + 2 => [ + 69, + 23, + ], ], ], // with scale data @@ -225,9 +241,18 @@ class GisGeometryTest extends TestCase ], false, [ - 0 => [14, 140], - 1 => [86, 60], - 2 => [128, 164], + 0 => [ + 14, + 140, + ], + 1 => [ + 86, + 60, + ], + 2 => [ + 128, + 164, + ], ], ], // linear output @@ -235,7 +260,14 @@ class GisGeometryTest extends TestCase '12 35,48 75,69 23', null, true, - [12, 35, 48, 75, 69, 23], + [ + 12, + 35, + 48, + 75, + 69, + 23, + ], ], // if a single part of a coordinate is empty [ @@ -243,9 +275,18 @@ class GisGeometryTest extends TestCase null, false, [ - 0 => [12, 35], - 1 => [48, 75], - 2 => [0, 0], + 0 => [ + 12, + 35, + ], + 1 => [ + 48, + 75, + ], + 2 => [ + 0, + 0, + ], ], ], ]; @@ -267,7 +308,10 @@ class GisGeometryTest extends TestCase $output, $this->_callProtectedFunction( 'getBoundsForOl', - [$srid, $scale_data] + [ + $srid, + $scale_data, + ] ) ); } @@ -294,8 +338,8 @@ class GisGeometryTest extends TestCase . 'map.getProjectionObject())); ' . 'bound.extend(new OpenLayers.LonLat(1, 1).transform(' . 'new OpenLayers.Projection("EPSG:4326"), ' - . 'map.getProjectionObject()));' - ] + . 'map.getProjectionObject()));', + ], ]; } @@ -316,7 +360,10 @@ class GisGeometryTest extends TestCase $output, $this->_callProtectedFunction( 'getPolygonArrayForOpenLayers', - [$polygons, $srid] + [ + $polygons, + $srid, + ] ) ); } @@ -339,8 +386,8 @@ class GisGeometryTest extends TestCase . 'new Array(' . '(new OpenLayers.Geometry.Point(0,0)).transform(' . 'new OpenLayers.Projection("EPSG:4326"), ' - . 'map.getProjectionObject()))))))' - ] + . 'map.getProjectionObject()))))))', + ], ]; } } diff --git a/test/classes/Gis/GisLineStringTest.php b/test/classes/Gis/GisLineStringTest.php index 7279f0cab2..e23d485819 100644 --- a/test/classes/Gis/GisLineStringTest.php +++ b/test/classes/Gis/GisLineStringTest.php @@ -61,10 +61,16 @@ class GisLineStringTest extends GisGeomTestCase 0 => [ 'LINESTRING' => [ 'no_of_points' => 2, - 0 => ['x' => 5.02, 'y' => 8.45], - 1 => ['x' => 6.14, 'y' => 0.15] - ] - ] + 0 => [ + 'x' => 5.02, + 'y' => 8.45, + ], + 1 => [ + 'x' => 6.14, + 'y' => 0.15, + ] + ], + ], ]; $temp2 = $temp1; @@ -83,29 +89,29 @@ class GisLineStringTest extends GisGeomTestCase $temp1, 0, null, - 'LINESTRING(5.02 8.45,6.14 0.15)' + 'LINESTRING(5.02 8.45,6.14 0.15)', ], // if a coordinate is missing, default is empty string [ $temp2, 0, null, - 'LINESTRING(5.02 8.45,6.14 0.15,1.56 )' + 'LINESTRING(5.02 8.45,6.14 0.15,1.56 )', ], // if no_of_points is not valid, it is considered as 2 [ $temp3, 0, null, - 'LINESTRING(5.02 8.45,6.14 0.15)' + 'LINESTRING(5.02 8.45,6.14 0.15)', ], // missing coordinates are replaced with provided values (3rd parameter) [ $temp4, 0, '0', - 'LINESTRING(5.02 8.45,6.14 0.15,0 0)' - ] + 'LINESTRING(5.02 8.45,6.14 0.15,0 0)', + ], ]; } @@ -119,9 +125,15 @@ class GisLineStringTest extends GisGeomTestCase $temp = [ 'LINESTRING' => [ 'no_of_points' => 2, - 0 => ['x' => '5.02', 'y' => '8.45'], - 1 => ['x' => '6.14', 'y' => '0.15'] - ] + 0 => [ + 'x' => '5.02', + 'y' => '8.45', + ], + 1 => [ + 'x' => '6.14', + 'y' => '0.15', + ] + ], ]; $temp1 = $temp; $temp1['gis_type'] = 'LINESTRING'; @@ -133,15 +145,15 @@ class GisLineStringTest extends GisGeomTestCase [ 'srid' => '124', 0 => $temp - ] + ], ], [ 'LINESTRING(5.02 8.45,6.14 0.15)', 2, [ - 2 => $temp1 - ] - ] + 2 => $temp1, + ], + ], ]; } @@ -159,9 +171,9 @@ class GisLineStringTest extends GisGeomTestCase 'minX' => 12, 'maxX' => 69, 'minY' => 23, - 'maxY' => 78 - ] - ] + 'maxY' => 78, + ], + ], ]; } @@ -214,10 +226,10 @@ class GisLineStringTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], - imagecreatetruecolor(120, 150) - ] + imagecreatetruecolor(120, 150), + ], ]; } @@ -266,10 +278,10 @@ class GisLineStringTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -317,12 +329,12 @@ class GisLineStringTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], '/^(<polyline points="0,218 72,138 114,242 26,198 4,182 46,132 " ' . 'name="svg" id="svg)(\d+)(" class="linestring vector" fill="none" ' - . 'stroke="#B02EE0" stroke-width="2"\/>)$/' - ] + . 'stroke="#B02EE0" stroke-width="2"\/>)$/', + ], ]; } @@ -396,8 +408,8 @@ class GisLineStringTest extends GisGeomTestCase . 'ProjectionObject()), (new OpenLayers.Geometry.Point(35,78)).' . 'transform(new OpenLayers.Projection("EPSG:4326"), map.' . 'getProjectionObject()))), null, {"strokeColor":"#B02EE0",' - . '"strokeWidth":2,"label":"Ol","fontSize":10}));' - ] + . '"strokeWidth":2,"label":"Ol","fontSize":10}));', + ], ]; } } diff --git a/test/classes/Gis/GisMultiLineStringTest.php b/test/classes/Gis/GisMultiLineStringTest.php index ef95babf2a..192544afef 100644 --- a/test/classes/Gis/GisMultiLineStringTest.php +++ b/test/classes/Gis/GisMultiLineStringTest.php @@ -63,16 +63,28 @@ class GisMultiLineStringTest extends GisGeomTestCase 'no_of_lines' => 2, 0 => [ 'no_of_points' => 2, - 0 => ['x' => 5.02, 'y' => 8.45], - 1 => ['x' => 6.14, 'y' => 0.15] + 0 => [ + 'x' => 5.02, + 'y' => 8.45, + ], + 1 => [ + 'x' => 6.14, + 'y' => 0.15, + ] ], 1 => [ 'no_of_points' => 2, - 0 => ['x' => 1.23, 'y' => 4.25], - 1 => ['x' => 9.15, 'y' => 0.47] + 0 => [ + 'x' => 1.23, + 'y' => 4.25, + ], + 1 => [ + 'x' => 9.15, + 'y' => 0.47, + ] ] - ] - ] + ], + ], ]; $temp1 = $temp; @@ -89,42 +101,42 @@ class GisMultiLineStringTest extends GisGeomTestCase $temp, 0, null, - 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))' + 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))', ], // values at undefined index [ $temp, 1, null, - 'MULTILINESTRING(( , ))' + 'MULTILINESTRING(( , ))', ], // if a coordinate is missing, default is empty string [ $temp1, 0, null, - 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 ))' + 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 ))', ], // missing coordinates are replaced with provided values (3rd parameter) [ $temp1, 0, '0', - 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0))' + 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0))', ], // at least one line should be there [ $temp2, 0, null, - 'MULTILINESTRING((5.02 8.45,6.14 0.15))' + 'MULTILINESTRING((5.02 8.45,6.14 0.15))', ], // a line should have at least two points [ $temp3, 0, '0', - 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))' + 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))', ], ]; } @@ -141,14 +153,26 @@ class GisMultiLineStringTest extends GisGeomTestCase 'parts' => [ 0 => [ 'points' => [ - 0 => ['x' => 5.02, 'y' => 8.45], - 1 => ['x' => 6.14, 'y' => 0.15], + 0 => [ + 'x' => 5.02, + 'y' => 8.45, + ], + 1 => [ + 'x' => 6.14, + 'y' => 0.15, + ], ], ], 1 => [ 'points' => [ - 0 => ['x' => 1.23, 'y' => 4.25], - 1 => ['x' => 9.15, 'y' => 0.47], + 0 => [ + 'x' => 1.23, + 'y' => 4.25, + ], + 1 => [ + 'x' => 9.15, + 'y' => 0.47, + ], ], ], ], @@ -172,15 +196,27 @@ class GisMultiLineStringTest extends GisGeomTestCase 'no_of_lines' => 2, 0 => [ 'no_of_points' => 2, - 0 => ['x' => 5.02, 'y' => 8.45], - 1 => ['x' => 6.14, 'y' => 0.15], + 0 => [ + 'x' => 5.02, + 'y' => 8.45, + ], + 1 => [ + 'x' => 6.14, + 'y' => 0.15, + ], ], 1 => [ 'no_of_points' => 2, - 0 => ['x' => 1.23, 'y' => 4.25], - 1 => ['x' => 9.15, 'y' => 0.47], + 0 => [ + 'x' => 1.23, + 'y' => 4.25, + ], + 1 => [ + 'x' => 9.15, + 'y' => 0.47, + ], ] - ] + ], ]; $temp1 = $temp; @@ -193,15 +229,15 @@ class GisMultiLineStringTest extends GisGeomTestCase [ 'srid' => '124', 0 => $temp - ] + ], ], [ 'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))', 2, [ - 2 => $temp1 - ] - ] + 2 => $temp1, + ], + ], ]; } @@ -219,9 +255,9 @@ class GisMultiLineStringTest extends GisGeomTestCase 'minX' => 17, 'maxX' => 178, 'minY' => 10, - 'maxY' => 75 - ] - ] + 'maxY' => 75, + ], + ], ]; } @@ -275,10 +311,10 @@ class GisMultiLineStringTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], - imagecreatetruecolor(120, 150) - ] + imagecreatetruecolor(120, 150), + ], ]; } @@ -327,10 +363,10 @@ class GisMultiLineStringTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -378,14 +414,14 @@ class GisMultiLineStringTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], '/^(<polyline points="48,260 70,242 100,138 " name="svg" ' . 'class="linestring vector" fill="none" stroke="#B02EE0" ' . 'stroke-width="2" id="svg)(\d+)("\/><polyline points="48,268 10,' . '242 332,182 " name="svg" class="linestring vector" fill="none" ' - . 'stroke="#B02EE0" stroke-width="2" id="svg)(\d+)("\/>)$/' - ] + . 'stroke="#B02EE0" stroke-width="2" id="svg)(\d+)("\/>)$/', + ], ]; } @@ -460,8 +496,8 @@ class GisMultiLineStringTest extends GisGeomTestCase . '("EPSG:4326"), map.getProjectionObject()), (new OpenLayers.Geo' . 'metry.Point(178,53)).transform(new OpenLayers.Projection("EPSG:' . '4326"), map.getProjectionObject()))))), null, {"strokeColor":"' - . '#B02EE0","strokeWidth":2,"label":"Ol","fontSize":10}));' - ] + . '#B02EE0","strokeWidth":2,"label":"Ol","fontSize":10}));', + ], ]; } } diff --git a/test/classes/Gis/GisMultiPointTest.php b/test/classes/Gis/GisMultiPointTest.php index 0b07f0c966..f99d19bbd0 100644 --- a/test/classes/Gis/GisMultiPointTest.php +++ b/test/classes/Gis/GisMultiPointTest.php @@ -63,14 +63,14 @@ class GisMultiPointTest extends GisGeomTestCase 'no_of_points' => 2, 0 => [ 'x' => 5.02, - 'y' => 8.45 + 'y' => 8.45, ], 1 => [ 'x' => 1.56, - 'y' => 4.36 + 'y' => 4.36, ] - ] - ] + ], + ], ]; $gis_data2 = $gis_data1; @@ -81,14 +81,14 @@ class GisMultiPointTest extends GisGeomTestCase $gis_data1, 0, null, - 'MULTIPOINT(5.02 8.45,1.56 4.36)' + 'MULTIPOINT(5.02 8.45,1.56 4.36)', ], [ $gis_data2, 0, null, - 'MULTIPOINT(5.02 8.45)' - ] + 'MULTIPOINT(5.02 8.45)', + ], ]; } @@ -102,8 +102,14 @@ class GisMultiPointTest extends GisGeomTestCase $gis_data = [ 'numpoints' => 2, 'points' => [ - 0 => ['x' => 5.02, 'y' => 8.45], - 1 => ['x' => 6.14, 'y' => 0.15] + 0 => [ + 'x' => 5.02, + 'y' => 8.45, + ], + 1 => [ + 'x' => 6.14, + 'y' => 0.15, + ], ] ]; @@ -123,9 +129,15 @@ class GisMultiPointTest extends GisGeomTestCase $temp1 = [ 'MULTIPOINT' => [ 'no_of_points' => 2, - 0 => ['x' => '5.02', 'y' => '8.45'], - 1 => ['x' => '6.14', 'y' => '0.15'] - ] + 0 => [ + 'x' => '5.02', + 'y' => '8.45', + ], + 1 => [ + 'x' => '6.14', + 'y' => '0.15', + ] + ], ]; $temp2 = $temp1; $temp2['gis_type'] = 'MULTIPOINT'; @@ -137,15 +149,15 @@ class GisMultiPointTest extends GisGeomTestCase [ 'srid' => '124', 0 => $temp1 - ] + ], ], [ 'MULTIPOINT(5.02 8.45,6.14 0.15)', 2, [ - 2 => $temp2 - ] - ] + 2 => $temp2, + ], + ], ]; } @@ -163,9 +175,9 @@ class GisMultiPointTest extends GisGeomTestCase 'minX' => 12, 'maxX' => 69, 'minY' => 23, - 'maxY' => 78 - ] - ] + 'maxY' => 78, + ], + ], ]; } @@ -218,10 +230,10 @@ class GisMultiPointTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], imagecreatetruecolor(120, 150), - ] + ], ]; } @@ -270,10 +282,10 @@ class GisMultiPointTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -321,7 +333,7 @@ class GisMultiPointTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], '/^(<circle cx="72" cy="138" r="3" name="svg" class="multipoint ' . 'vector" fill="white" stroke="#B02EE0" stroke-width="2" id="svg)' @@ -333,8 +345,8 @@ class GisMultiPointTest extends GisGeomTestCase . 'class="multipoint vector" fill="white" stroke="#B02EE0" stroke-' . 'width="2" id="svg)(\d+)("\/><circle cx="46" cy="132" r="3" name=' . '"svg" class="multipoint vector" fill="white" stroke="#B02EE0" ' - . 'stroke-width="2" id="svg)(\d+)("\/>)$/' - ] + . 'stroke-width="2" id="svg)(\d+)("\/>)$/', + ], ]; } @@ -409,8 +421,8 @@ class GisMultiPointTest extends GisGeomTestCase . '(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject(' . ')))), null, {"pointRadius":3,"fillColor":"#ffffff","strokeColor"' . ':"#B02EE0","strokeWidth":2,"label":"Ol","labelYOffset":-8,' - . '"fontSize":10}));' - ] + . '"fontSize":10}));', + ], ]; } } diff --git a/test/classes/Gis/GisMultiPolygonTest.php b/test/classes/Gis/GisMultiPolygonTest.php index f08d5e9aa4..55bc0a7d1a 100644 --- a/test/classes/Gis/GisMultiPolygonTest.php +++ b/test/classes/Gis/GisMultiPolygonTest.php @@ -64,31 +64,70 @@ class GisMultiPolygonTest extends GisGeomTestCase 'no_of_lines' => 2, 0 => [ 'no_of_points' => 5, - 0 => ['x' => 35, 'y' => 10], - 1 => ['x' => 10, 'y' => 20], - 2 => ['x' => 15, 'y' => 40], - 3 => ['x' => 45, 'y' => 45], - 4 => ['x' => 35, 'y' => 10], + 0 => [ + 'x' => 35, + 'y' => 10, + ], + 1 => [ + 'x' => 10, + 'y' => 20, + ], + 2 => [ + 'x' => 15, + 'y' => 40, + ], + 3 => [ + 'x' => 45, + 'y' => 45, + ], + 4 => [ + 'x' => 35, + 'y' => 10, + ], ], 1 => [ 'no_of_points' => 4, - 0 => ['x' => 20, 'y' => 30], - 1 => ['x' => 35, 'y' => 32], - 2 => ['x' => 30, 'y' => 20], - 3 => ['x' => 20, 'y' => 30], + 0 => [ + 'x' => 20, + 'y' => 30, + ], + 1 => [ + 'x' => 35, + 'y' => 32, + ], + 2 => [ + 'x' => 30, + 'y' => 20, + ], + 3 => [ + 'x' => 20, + 'y' => 30, + ], ] ], 1 => [ 'no_of_lines' => 1, 0 => [ 'no_of_points' => 4, - 0 => ['x' => 123, 'y' => 0], - 1 => ['x' => 23, 'y' => 30], - 2 => ['x' => 17, 'y' => 63], - 3 => ['x' => 123, 'y' => 0], + 0 => [ + 'x' => 123, + 'y' => 0, + ], + 1 => [ + 'x' => 23, + 'y' => 30, + ], + 2 => [ + 'x' => 17, + 'y' => 63, + ], + 3 => [ + 'x' => 123, + 'y' => 0, + ], ] ] - ] + ], ]; } @@ -100,7 +139,7 @@ class GisMultiPolygonTest extends GisGeomTestCase public function providerForTestGenerateWkt() { $temp = [ - 0 => $this->_getData() + 0 => $this->_getData(), ]; $temp1 = $temp; @@ -118,7 +157,7 @@ class GisMultiPolygonTest extends GisGeomTestCase 0, null, 'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)' - . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))' + . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))', ], // at lease one polygon should be there [ @@ -126,7 +165,7 @@ class GisMultiPolygonTest extends GisGeomTestCase 0, null, 'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)' - . ',(20 30,35 32,30 20,20 30)))' + . ',(20 30,35 32,30 20,20 30)))', ], // a polygon should have at least one ring [ @@ -134,7 +173,7 @@ class GisMultiPolygonTest extends GisGeomTestCase 0, null, 'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)' - . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))' + . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))', ], // a ring should have at least four points [ @@ -142,7 +181,7 @@ class GisMultiPolygonTest extends GisGeomTestCase 0, '0', 'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)' - . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))' + . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))', ], ]; } @@ -167,16 +206,16 @@ class GisMultiPolygonTest extends GisGeomTestCase [ 'srid' => '124', 0 => $temp - ] + ], ], [ 'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)' . ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))', 2, [ - 2 => $temp1 - ] - ] + 2 => $temp1, + ], + ], ]; } @@ -207,34 +246,73 @@ class GisMultiPolygonTest extends GisGeomTestCase 'parts' => [ 0 => [ 'points' => [ - 0 => ['x' => 10, 'y' => 10], - 1 => ['x' => 10, 'y' => 40], - 2 => ['x' => 50, 'y' => 40], - 3 => ['x' => 50, 'y' => 10], - 4 => ['x' => 10, 'y' => 10], + 0 => [ + 'x' => 10, + 'y' => 10, + ], + 1 => [ + 'x' => 10, + 'y' => 40, + ], + 2 => [ + 'x' => 50, + 'y' => 40, + ], + 3 => [ + 'x' => 50, + 'y' => 10, + ], + 4 => [ + 'x' => 10, + 'y' => 10, + ], ], ], 1 => [ 'points' => [ - 0 => ['x' => 60, 'y' => 40], - 1 => ['x' => 75, 'y' => 65], - 2 => ['x' => 90, 'y' => 40], - 3 => ['x' => 60, 'y' => 40], + 0 => [ + 'x' => 60, + 'y' => 40, + ], + 1 => [ + 'x' => 75, + 'y' => 65, + ], + 2 => [ + 'x' => 90, + 'y' => 40, + ], + 3 => [ + 'x' => 60, + 'y' => 40, + ], ], ], 2 => [ 'points' => [ - 0 => ['x' => 20, 'y' => 20], - 1 => ['x' => 40, 'y' => 20], - 2 => ['x' => 25, 'y' => 30], - 3 => ['x' => 20, 'y' => 20], + 0 => [ + 'x' => 20, + 'y' => 20, + ], + 1 => [ + 'x' => 40, + 'y' => 20, + ], + 2 => [ + 'x' => 25, + 'y' => 30, + ], + 3 => [ + 'x' => 20, + 'y' => 20, + ], ], ], ], ], 'MULTIPOLYGON(((10 10,10 40,50 40,50 10,10 10),(20 20,40 20,25 30' - . ',20 20)),((60 40,75 65,90 40,60 40)))' - ] + . ',20 20)),((60 40,75 65,90 40,60 40)))', + ], ]; } @@ -253,8 +331,8 @@ class GisMultiPolygonTest extends GisGeomTestCase 'minX' => 16, 'maxX' => 147, 'minY' => 0, - 'maxY' => 83 - ] + 'maxY' => 83, + ], ], [ 'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20' @@ -263,9 +341,9 @@ class GisMultiPolygonTest extends GisGeomTestCase 'minX' => 10, 'maxX' => 105, 'minY' => 0, - 'maxY' => 73 - ] - ] + 'maxY' => 73, + ], + ], ]; } @@ -319,10 +397,10 @@ class GisMultiPolygonTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], imagecreatetruecolor(120, 150), - ] + ], ]; } @@ -373,10 +451,10 @@ class GisMultiPolygonTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -425,7 +503,7 @@ class GisMultiPolygonTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], '/^(<path d=" M 248, 208 L 270, 122 L 8, 138 Z " name="svg" class="' . 'multipolygon vector" stroke="black" stroke-width="0.5" fill="' @@ -433,8 +511,8 @@ class GisMultiPolygonTest extends GisGeomTestCase . '("\/><path d=" M 186, 288 L 88, 248 L 132, 142 Z " name="svg" ' . 'class="multipolygon vector" stroke="black" stroke-width="0.5" ' . 'fill="#B02EE0" fill-rule="evenodd" fill-opacity="0.8" id="svg)' - . '(\d+)("\/>)$/' - ] + . '(\d+)("\/>)$/', + ], ]; } @@ -516,8 +594,8 @@ class GisMultiPolygonTest extends GisGeomTestCase . '()), (new OpenLayers.Geometry.Point(105,0)).transform(new Open' . 'Layers.Projection("EPSG:4326"), map.getProjectionObject()))))))' . '), null, {"strokeColor":"#000000","strokeWidth":0.5,"fillColor":' - . '"#B02EE0","fillOpacity":0.8,"label":"Ol","fontSize":10}));' - ] + . '"#B02EE0","fillOpacity":0.8,"label":"Ol","fontSize":10}));', + ], ]; } } diff --git a/test/classes/Gis/GisPointTest.php b/test/classes/Gis/GisPointTest.php index 4550c1c52e..f74e5e20b4 100644 --- a/test/classes/Gis/GisPointTest.php +++ b/test/classes/Gis/GisPointTest.php @@ -59,34 +59,48 @@ class GisPointTest extends GisGeomTestCase { return [ [ - [0 => ['POINT' => ['x' => 5.02, 'y' => 8.45]]], + [ + 0 => [ + 'POINT' => [ + 'x' => 5.02, + 'y' => 8.45, + ], + ], + ], 0, null, - 'POINT(5.02 8.45)' + 'POINT(5.02 8.45)', ], [ - [0 => ['POINT' => ['x' => 5.02, 'y' => 8.45]]], + [ + 0 => [ + 'POINT' => [ + 'x' => 5.02, + 'y' => 8.45, + ], + ], + ], 1, null, - 'POINT( )' + 'POINT( )', ], [ [0 => ['POINT' => ['x' => 5.02]]], 0, null, - 'POINT(5.02 )' + 'POINT(5.02 )', ], [ [0 => ['POINT' => ['y' => 8.45]]], 0, null, - 'POINT( 8.45)' + 'POINT( 8.45)', ], [ [0 => ['POINT' => []]], 0, null, - 'POINT( )' + 'POINT( )', ], ]; } @@ -114,9 +128,12 @@ class GisPointTest extends GisGeomTestCase { return [ [ - ['x' => 5.02, 'y' => 8.45], - 'POINT(5.02 8.45)' - ] + [ + 'x' => 5.02, + 'y' => 8.45, + ], + 'POINT(5.02 8.45)', + ], ]; } @@ -134,9 +151,12 @@ class GisPointTest extends GisGeomTestCase [ 'srid' => '124', 0 => [ - 'POINT' => ['x' => '5.02', 'y' => '8.45'] + 'POINT' => [ + 'x' => '5.02', + 'y' => '8.45', + ] ], - ] + ], ], [ 'POINT(5.02 8.45)', @@ -144,10 +164,13 @@ class GisPointTest extends GisGeomTestCase [ 2 => [ 'gis_type' => 'POINT', - 'POINT' => ['x' => '5.02', 'y' => '8.45'] + 'POINT' => [ + 'x' => '5.02', + 'y' => '8.45', + ], ], - ] - ] + ], + ], ]; } @@ -166,8 +189,8 @@ class GisPointTest extends GisGeomTestCase 'maxX' => 12, 'minY' => 35, 'maxY' => 35, - ] - ] + ], + ], ]; } @@ -219,10 +242,10 @@ class GisPointTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], - imagecreatetruecolor(120, 150) - ] + imagecreatetruecolor(120, 150), + ], ]; } @@ -271,10 +294,10 @@ class GisPointTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -324,10 +347,10 @@ class GisPointTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], - '' - ] + '', + ], ]; } @@ -392,8 +415,8 @@ class GisPointTest extends GisGeomTestCase . 'transform(new OpenLayers.Projection("EPSG:4326"), map.get' . 'ProjectionObject()), null, {"pointRadius":3,"fillColor":"#ffffff"' . ',"strokeColor":"#B02EE0","strokeWidth":2,"label":"Ol","labelY' - . 'Offset":-8,"fontSize":10}));' - ] + . 'Offset":-8,"fontSize":10}));', + ], ]; } } diff --git a/test/classes/Gis/GisPolygonTest.php b/test/classes/Gis/GisPolygonTest.php index 344f4858b0..8fbeb72ce4 100644 --- a/test/classes/Gis/GisPolygonTest.php +++ b/test/classes/Gis/GisPolygonTest.php @@ -62,20 +62,47 @@ class GisPolygonTest extends GisGeomTestCase 'no_of_lines' => 2, 0 => [ 'no_of_points' => 5, - 0 => ['x' => 35, 'y' => 10], - 1 => ['x' => 10, 'y' => 20], - 2 => ['x' => 15, 'y' => 40], - 3 => ['x' => 45, 'y' => 45], - 4 => ['x' => 35, 'y' => 10], + 0 => [ + 'x' => 35, + 'y' => 10, + ], + 1 => [ + 'x' => 10, + 'y' => 20, + ], + 2 => [ + 'x' => 15, + 'y' => 40, + ], + 3 => [ + 'x' => 45, + 'y' => 45, + ], + 4 => [ + 'x' => 35, + 'y' => 10, + ], ], 1 => [ 'no_of_points' => 4, - 0 => ['x' => 20, 'y' => 30], - 1 => ['x' => 35, 'y' => 32], - 2 => ['x' => 30, 'y' => 20], - 3 => ['x' => 20, 'y' => 30], + 0 => [ + 'x' => 20, + 'y' => 30, + ], + 1 => [ + 'x' => 35, + 'y' => 32, + ], + 2 => [ + 'x' => 30, + 'y' => 20, + ], + 3 => [ + 'x' => 20, + 'y' => 30, + ], ] - ] + ], ]; } @@ -87,7 +114,7 @@ class GisPolygonTest extends GisGeomTestCase public function providerForTestGenerateWkt() { $temp = [ - 0 => $this->_getData() + 0 => $this->_getData(), ]; $temp1 = $temp; @@ -104,42 +131,42 @@ class GisPolygonTest extends GisGeomTestCase $temp, 0, null, - 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))' + 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))', ], // values at undefined index [ $temp, 1, null, - 'POLYGON(( , , , ))' + 'POLYGON(( , , , ))', ], // if a coordinate is missing, default is empty string [ $temp1, 0, null, - 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 ))' + 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 ))', ], // missing coordinates are replaced with provided values (3rd parameter) [ $temp1, 0, '0', - 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 0))' + 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 0))', ], // should have at least one ring [ $temp2, 0, '0', - 'POLYGON((35 10,10 20,15 40,45 45,35 10))' + 'POLYGON((35 10,10 20,15 40,45 45,35 10))', ], // a ring should have at least four points [ $temp3, 0, '0', - 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))' + 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))', ], ]; } @@ -164,15 +191,15 @@ class GisPolygonTest extends GisGeomTestCase [ 'srid' => '124', 0 => $temp - ] + ], ], [ 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))', 2, [ - 2 => $temp1 - ] - ] + 2 => $temp1, + ], + ], ]; } @@ -200,31 +227,61 @@ class GisPolygonTest extends GisGeomTestCase return [ [ [ - 0 => ['x' => 35, 'y' => 10], - 1 => ['x' => 10, 'y' => 10], - 2 => ['x' => 15, 'y' => 40] + 0 => [ + 'x' => 35, + 'y' => 10, + ], + 1 => [ + 'x' => 10, + 'y' => 10, + ], + 2 => [ + 'x' => 15, + 'y' => 40, + ], ], - -375.00 + -375.00, ], // first point of the ring repeated as the last point [ [ - 0 => ['x' => 35, 'y' => 10], - 1 => ['x' => 10, 'y' => 10], - 2 => ['x' => 15, 'y' => 40], - 3 => ['x' => 35, 'y' => 10] + 0 => [ + 'x' => 35, + 'y' => 10, + ], + 1 => [ + 'x' => 10, + 'y' => 10, + ], + 2 => [ + 'x' => 15, + 'y' => 40, + ], + 3 => [ + 'x' => 35, + 'y' => 10, + ], ], - -375.00 + -375.00, ], // anticlockwise gives positive area [ [ - 0 => ['x' => 15, 'y' => 40], - 1 => ['x' => 10, 'y' => 10], - 2 => ['x' => 35, 'y' => 10] + 0 => [ + 'x' => 15, + 'y' => 40, + ], + 1 => [ + 'x' => 10, + 'y' => 10, + ], + 2 => [ + 'x' => 35, + 'y' => 10, + ], ], - 375.00 - ] + 375.00, + ], ]; } @@ -254,36 +311,60 @@ class GisPolygonTest extends GisGeomTestCase public function providerForTestIsPointInsidePolygon() { $ring = [ - 0 => ['x' => 35, 'y' => 10], - 1 => ['x' => 10, 'y' => 10], - 2 => ['x' => 15, 'y' => 40], - 3 => ['x' => 35, 'y' => 10] + 0 => [ + 'x' => 35, + 'y' => 10, + ], + 1 => [ + 'x' => 10, + 'y' => 10, + ], + 2 => [ + 'x' => 15, + 'y' => 40, + ], + 3 => [ + 'x' => 35, + 'y' => 10, + ], ]; return [ // point inside the ring [ - ['x' => 20, 'y' => 15], + [ + 'x' => 20, + 'y' => 15, + ], $ring, - true + true, ], // point on an edge of the ring [ - ['x' => 20, 'y' => 10], + [ + 'x' => 20, + 'y' => 10, + ], $ring, - false + false, ], // point on a vertex of the ring [ - ['x' => 10, 'y' => 10], + [ + 'x' => 10, + 'y' => 10, + ], $ring, - false + false, ], // point outside the ring [ - ['x' => 5, 'y' => 10], + [ + 'x' => 5, + 'y' => 10, + ], $ring, - false + false, ], ]; } @@ -324,7 +405,7 @@ class GisPolygonTest extends GisGeomTestCase ], [ $temp['POLYGON'][1] - ] + ], ]; } @@ -343,7 +424,7 @@ class GisPolygonTest extends GisGeomTestCase 'maxX' => 123, 'minY' => 0, 'maxY' => 63, - ] + ], ], [ 'POLYGON((35 10,10 20,15 40,45 45,35 10),' @@ -352,8 +433,8 @@ class GisPolygonTest extends GisGeomTestCase 'minX' => 10, 'maxX' => 45, 'minY' => 10, - 'maxY' => 45 - ] + 'maxY' => 45, + ], ], ]; } @@ -406,10 +487,10 @@ class GisPolygonTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], - imagecreatetruecolor(120, 150) - ] + imagecreatetruecolor(120, 150), + ], ]; } @@ -458,10 +539,10 @@ class GisPolygonTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], new TCPDF(), - ] + ], ]; } @@ -509,13 +590,13 @@ class GisPolygonTest extends GisGeomTestCase 'x' => 12, 'y' => 69, 'scale' => 2, - 'height' => 150 + 'height' => 150, ], '/^(<path d=" M 222, 288 L 22, 228 L 10, 162 Z " name="svg" ' . 'id="svg)(\d+)(" class="polygon vector" stroke="black" ' . 'stroke-width="0.5" fill="#B02EE0" fill-rule="evenodd" ' - . 'fill-opacity="0.8"\/>)$/' - ] + . 'fill-opacity="0.8"\/>)$/', + ], ]; } @@ -587,8 +668,8 @@ class GisPolygonTest extends GisGeomTestCase . 'Geometry.Point(123,0)).transform(new OpenLayers.Projection' . '("EPSG:4326"), map.getProjectionObject()))))), null, {"stroke' . 'Color":"#000000","strokeWidth":0.5,"fillColor":"#B02EE0",' - . '"fillOpacity":0.8,"label":"Ol","fontSize":10}));' - ] + . '"fillOpacity":0.8,"label":"Ol","fontSize":10}));', + ], ]; } @@ -615,12 +696,24 @@ class GisPolygonTest extends GisGeomTestCase return [ [ [ - ['x' => 0, 'y' => 0], - ['x' => 0, 'y' => 1], - ['x' => 1, 'y' => 1], - ['x' => 1, 'y' => 0] + [ + 'x' => 0, + 'y' => 0, + ], + [ + 'x' => 0, + 'y' => 1, + ], + [ + 'x' => 1, + 'y' => 1, + ], + [ + 'x' => 1, + 'y' => 0, + ], ], - ] + ], ]; } } diff --git a/test/classes/ImportTest.php b/test/classes/ImportTest.php index 526c1e3fc5..c85db874e2 100644 --- a/test/classes/ImportTest.php +++ b/test/classes/ImportTest.php @@ -92,37 +92,58 @@ class ImportTest extends TestCase public function testLookForUse() { $this->assertEquals( - [null, null], + [ + null, + null, + ], $this->import->lookForUse(null, null, null) ); $this->assertEquals( - ['myDb', null], + [ + 'myDb', + null, + ], $this->import->lookForUse(null, 'myDb', null) ); $this->assertEquals( - ['myDb', true], + [ + 'myDb', + true, + ], $this->import->lookForUse(null, 'myDb', true) ); $this->assertEquals( - ['myDb', true], + [ + 'myDb', + true, + ], $this->import->lookForUse('select 1 from myTable', 'myDb', true) ); $this->assertEquals( - ['anotherDb', true], + [ + 'anotherDb', + true, + ], $this->import->lookForUse('use anotherDb', 'myDb', false) ); $this->assertEquals( - ['anotherDb', true], + [ + 'anotherDb', + true, + ], $this->import->lookForUse('use anotherDb', 'myDb', true) ); $this->assertEquals( - ['anotherDb', true], + [ + 'anotherDb', + true, + ], $this->import->lookForUse('use `anotherDb`;', 'myDb', true) ); } @@ -150,12 +171,30 @@ class ImportTest extends TestCase public function provGetColumnAlphaName() { return [ - ['A', 1], - ['Z', 0], - ['AA', 27], - ['AZ', 52], - ['BA', 53], - ['BB', 54], + [ + 'A', + 1, + ], + [ + 'Z', + 0, + ], + [ + 'AA', + 27, + ], + [ + 'AZ', + 52, + ], + [ + 'BA', + 53, + ], + [ + 'BB', + 54, + ], ]; } @@ -182,12 +221,30 @@ class ImportTest extends TestCase public function provGetColumnNumberFromName() { return [ - [1, 'A'], - [26, 'Z'], - [27, 'AA'], - [52, 'AZ'], - [53, 'BA'], - [54, 'BB'], + [ + 1, + 'A', + ], + [ + 26, + 'Z', + ], + [ + 27, + 'AA', + ], + [ + 52, + 'AZ', + ], + [ + 53, + 'BA', + ], + [ + 54, + 'BB', + ], ]; } @@ -214,10 +271,22 @@ class ImportTest extends TestCase public function provGetDecimalPrecision() { return [ - [2, '2,1'], - [6, '6,2'], - [6, '6,0'], - [16, '16,2'], + [ + 2, + '2,1', + ], + [ + 6, + '6,2', + ], + [ + 6, + '6,0', + ], + [ + 16, + '16,2', + ], ]; } @@ -244,10 +313,22 @@ class ImportTest extends TestCase public function provGetDecimalScale() { return [ - [1, '2,1'], - [2, '6,2'], - [0, '6,0'], - [20, '30,20'], + [ + 1, + '2,1', + ], + [ + 2, + '6,2', + ], + [ + 0, + '6,0', + ], + [ + 20, + '30,20', + ], ]; } @@ -274,10 +355,34 @@ class ImportTest extends TestCase public function provGetDecimalSize() { return [ - [[2, 1, '2,1'], '2.1'], - [[2, 1, '2,1'], '6.2'], - [[3, 1, '3,1'], '10.0'], - [[4, 2, '4,2'], '30.20'], + [ + [ + 2, + 1, + '2,1', + ], '2.1', + ], + [ + [ + 2, + 1, + '2,1', + ], '6.2', + ], + [ + [ + 3, + 1, + '3,1', + ], '10.0', + ], + [ + [ + 4, + 2, + '4,2', + ], '30.20', + ], ]; } @@ -307,19 +412,71 @@ class ImportTest extends TestCase public function provDetectType() { return [ - [Import::NONE, null, 'NULL'], - [Import::NONE, Import::NONE, 'NULL'], - [Import::INT, Import::INT, 'NULL'], - [Import::VARCHAR, Import::VARCHAR, 'NULL'], - [Import::VARCHAR, null, null], - [Import::VARCHAR, Import::INT, null], - [Import::INT, Import::INT, '10'], - [Import::DECIMAL, Import::DECIMAL, '10.2'], - [Import::DECIMAL, Import::INT, '10.2'], - [Import::BIGINT, Import::BIGINT, '2147483648'], - [Import::BIGINT, Import::INT, '2147483648'], - [Import::VARCHAR, Import::VARCHAR, 'test'], - [Import::VARCHAR, Import::INT, 'test'], + [ + Import::NONE, + null, + 'NULL', + ], + [ + Import::NONE, + Import::NONE, + 'NULL', + ], + [ + Import::INT, + Import::INT, + 'NULL', + ], + [ + Import::VARCHAR, + Import::VARCHAR, + 'NULL', + ], + [ + Import::VARCHAR, + null, + null, + ], + [ + Import::VARCHAR, + Import::INT, + null, + ], + [ + Import::INT, + Import::INT, + '10', + ], + [ + Import::DECIMAL, + Import::DECIMAL, + '10.2', + ], + [ + Import::DECIMAL, + Import::INT, + '10.2', + ], + [ + Import::BIGINT, + Import::BIGINT, + '2147483648', + ], + [ + Import::BIGINT, + Import::INT, + '2147483648', + ], + [ + Import::VARCHAR, + Import::VARCHAR, + 'test', + ], + [ + Import::VARCHAR, + Import::INT, + 'test', + ], ]; } @@ -393,7 +550,7 @@ class ImportTest extends TestCase // URL to matched rows. $_url_params = [ 'db' => 'PMA', - 'sql_query' => $simulated_query + 'sql_query' => $simulated_query, ]; $matched_rows_url = 'sql.php' . Url::getCommon($_url_params); @@ -403,7 +560,7 @@ class ImportTest extends TestCase $analyzed_sql_results['query'] ), 'matched_rows' => 2, - 'matched_rows_url' => $matched_rows_url + 'matched_rows_url' => $matched_rows_url, ], $simulated_data ); @@ -431,7 +588,7 @@ class ImportTest extends TestCase 'TOKUDB', 'XTRADB', 'SEQUENCE', - 'BDB' + 'BDB', ]; $check_query = 'SELECT `ENGINE` FROM `information_schema`.`tables` ' diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php index df1f10aa4c..8df0305af9 100644 --- a/test/classes/InsertEditTest.php +++ b/test/classes/InsertEditTest.php @@ -98,7 +98,10 @@ class InsertEditTest extends TestCase */ public function testGetFormParametersForInsertForm() { - $where_clause = ['foo' => 'bar ', '1' => ' test']; + $where_clause = [ + 'foo' => 'bar ', + '1' => ' test' + ]; $_POST['clause_is_unique'] = false; $_POST['sql_query'] = 'SELECT a'; $GLOBALS['goto'] = 'index.php'; @@ -139,7 +142,11 @@ class InsertEditTest extends TestCase ); $this->assertEquals( - [1, 2, 3], + [ + 1, + 2, + 3, + ], $this->callProtectedMethod('getWhereClauseArray', [[1, 2, 3]]) ); @@ -156,7 +163,10 @@ class InsertEditTest extends TestCase */ public function testAnalyzeWhereClause() { - $clauses = ['a=1', 'b="fo\o"']; + $clauses = [ + 'a=1', + 'b="fo\o"', + ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() @@ -188,18 +198,24 @@ class InsertEditTest extends TestCase $result = $this->callProtectedMethod('analyzeWhereClauses', [ $clauses, 'table', - 'db' + 'db', ]); $this->assertEquals( [ - ['a=1', 'b="fo\\\\o"'], - ['result1', 'result2'], + [ + 'a=1', + 'b="fo\\\\o"', + ], + [ + 'result1', + 'result2', + ], [ ['assoc1'], - ['assoc2'] + ['assoc2'], ], - '' + '', ], $result ); @@ -232,8 +248,11 @@ class InsertEditTest extends TestCase $this->insertEdit = new InsertEdit($GLOBALS['dbi']); $result = $this->callProtectedMethod('showEmptyResultMessageOrSetUniqueCondition', [ - ['1' => ['1' => 1]], 1, [], - 'SELECT', ['1' => 'result1'] + ['1' => ['1' => 1]], + 1, + [], + 'SELECT', + ['1' => 'result1'], ]); $this->assertTrue($result); @@ -252,7 +271,11 @@ class InsertEditTest extends TestCase $response->setValue($responseMock); $result = $this->callProtectedMethod('showEmptyResultMessageOrSetUniqueCondition', [ - [false], 0, ['1'], 'SELECT', ['1' => 'result1'] + [false], + 0, + ['1'], + 'SELECT', + ['1' => 'result1'], ]); $response->setValue($restoreInstance); @@ -288,7 +311,13 @@ class InsertEditTest extends TestCase $result = $this->callProtectedMethod('loadFirstRow', ['table', 'db']); $this->assertEquals( - ['result1', [false, false]], + [ + 'result1', + [ + false, + false, + ], + ], $result ); } @@ -300,7 +329,10 @@ class InsertEditTest extends TestCase */ public function testUrlParamsInEditMode() { - $where_clause_array = ['foo=1', 'bar=2']; + $where_clause_array = [ + 'foo=1', + 'bar=2', + ]; $_POST['sql_query'] = 'SELECT 1'; $result = $this->insertEdit->urlParamsInEditMode([1], $where_clause_array, ''); @@ -380,7 +412,9 @@ class InsertEditTest extends TestCase ]; $result = $this->callProtectedMethod('analyzeTableColumnsArray', [ - $column, [], false + $column, + [], + false, ]); $this->assertEquals( @@ -452,7 +486,8 @@ class InsertEditTest extends TestCase $this->assertEquals( $this->callProtectedMethod('getColumnTitle', [ - $column, [] + $column, + [], ]), 'f1<' ); @@ -461,7 +496,8 @@ class InsertEditTest extends TestCase $comments['f1<'] = 'comment>'; $result = $this->callProtectedMethod('getColumnTitle', [ - $column, $comments + $column, + $comments, ]); $this->assertContains( @@ -483,7 +519,10 @@ class InsertEditTest extends TestCase public function testIsColumn() { $column = []; - $types = ['binary', 'varbinary']; + $types = [ + 'binary', + 'varbinary', + ]; $column['Type'] = 'binaryfoo'; $this->assertTrue($this->insertEdit->isColumn($column, $types)); @@ -497,7 +536,10 @@ class InsertEditTest extends TestCase $column['Type'] = 'barbinaryfoo'; $this->assertFalse($this->insertEdit->isColumn($column, $types)); - $types = ['char', 'varchar']; + $types = [ + 'char', + 'varchar', + ]; $column['Type'] = 'char(10)'; $this->assertTrue($this->insertEdit->isColumn($column, $types)); @@ -508,7 +550,12 @@ class InsertEditTest extends TestCase $column['Type'] = 'foochar'; $this->assertFalse($this->insertEdit->isColumn($column, $types)); - $types = ['blob', 'tinyblob', 'mediumblob', 'longblob']; + $types = [ + 'blob', + 'tinyblob', + 'mediumblob', + 'longblob', + ]; $column['Type'] = 'blob'; $this->assertTrue($this->insertEdit->isColumn($column, $types)); @@ -539,53 +586,83 @@ class InsertEditTest extends TestCase $column = []; $column['True_Type'] = 'set'; $this->assertEquals( - ['set', '', false], + [ + 'set', + '', + false, + ], $this->callProtectedMethod('getEnumSetAndTimestampColumns', [ - $column, false + $column, + false, ]) ); $column['True_Type'] = 'enum'; $this->assertEquals( - ['enum', '', false], + [ + 'enum', + '', + false, + ], $this->callProtectedMethod('getEnumSetAndTimestampColumns', [ - $column, false + $column, + false, ]) ); $column['True_Type'] = 'timestamp'; $column['Type'] = 'date'; $this->assertEquals( - ['date', ' nowrap', true], + [ + 'date', + ' nowrap', + true, + ], $this->callProtectedMethod('getEnumSetAndTimestampColumns', [ - $column, false + $column, + false, ]) ); $column['True_Type'] = 'timestamp'; $column['Type'] = 'date'; $this->assertEquals( - ['date', ' nowrap', false], + [ + 'date', + ' nowrap', + false, + ], $this->callProtectedMethod('getEnumSetAndTimestampColumns', [ - $column, true + $column, + true, ]) ); $column['True_Type'] = 'SET'; $column['Type'] = 'num'; $this->assertEquals( - ['num', ' nowrap', false], + [ + 'num', + ' nowrap', + false, + ], $this->callProtectedMethod('getEnumSetAndTimestampColumns', [ - $column, false + $column, + false, ]) ); $column['True_Type'] = ''; $column['Type'] = 'num'; $this->assertEquals( - ['num', ' nowrap', false], + [ + 'num', + ' nowrap', + false, + ], $this->callProtectedMethod('getEnumSetAndTimestampColumns', [ - $column, false + $column, + false, ]) ); } @@ -603,7 +680,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<td class="center">Binary</td>', $this->callProtectedMethod('getFunctionColumn', [ - $column, false, '', '', [], 0, 0, 0, false, false, [] + $column, + false, + '', + '', + [], + 0, + 0, + 0, + false, + false, + [], ]) ); @@ -612,7 +699,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<td class="center">Binary</td>', $this->callProtectedMethod('getFunctionColumn', [ - $column, true, '', '', [], 0, 0, 0, false, false, [] + $column, + true, + '', + '', + [], + 0, + 0, + 0, + false, + false, + [], ]) ); @@ -621,7 +718,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<td class="center">Binary</td>', $this->callProtectedMethod('getFunctionColumn', [ - $column, true, '', '', [], 0, 0, 0, false, false, [] + $column, + true, + '', + '', + [], + 0, + 0, + 0, + false, + false, + [], ]) ); @@ -630,7 +737,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<td class="center">--</td>', $this->callProtectedMethod('getFunctionColumn', [ - $column, true, '', '', [], 0, 0, 0, false, false, [] + $column, + true, + '', + '', + [], + 0, + 0, + 0, + false, + false, + [], ]) ); @@ -638,7 +755,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<td class="center">--</td>', $this->callProtectedMethod('getFunctionColumn', [ - $column, true, '', '', [], 0, 0, 0, false, false, [] + $column, + true, + '', + '', + [], + 0, + 0, + 0, + false, + false, + [], ]) ); @@ -647,7 +774,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<td class="center">--</td>', $this->callProtectedMethod('getFunctionColumn', [ - $column, true, '', '', ['int'], 0, 0, 0, false, false, [] + $column, + true, + '', + '', + ['int'], + 0, + 0, + 0, + false, + false, + [], ]) ); @@ -655,7 +792,17 @@ class InsertEditTest extends TestCase $this->assertContains( '<select name="funcsa" b tabindex="5" id="field_3_1"', $this->callProtectedMethod('getFunctionColumn', [ - $column, true, 'a', 'b', [], 2, 3, 3, false, false, [] + $column, + true, + 'a', + 'b', + [], + 2, + 3, + 3, + false, + false, + [], ]) ); } @@ -674,11 +821,20 @@ class InsertEditTest extends TestCase $column['Type'] = 0; $column['Field_md5'] = 'foobar'; $foreigners = [ - 'foreign_keys_data' => [] + 'foreign_keys_data' => [], ]; $result = $this->callProtectedMethod('getNullColumn', [ - $column, 'a', true, 2, 0, 1, "<script>", $foreigners, [], false + $column, + 'a', + true, + 2, + 0, + 1, + "<script>", + $foreigners, + [], + false, ]); $this->assertContains( @@ -713,7 +869,16 @@ class InsertEditTest extends TestCase // case 2 $column['Null'] = 'NO'; $result = $this->callProtectedMethod('getNullColumn', [ - $column, 'a', true, 2, 0, 1, "<script>", [], [], false + $column, + 'a', + true, + 2, + 0, + 1, + "<script>", + [], + [], + false, ]); $this->assertEquals( @@ -724,7 +889,16 @@ class InsertEditTest extends TestCase // case 3 $column['Null'] = 'YES'; $result = $this->callProtectedMethod('getNullColumn', [ - $column, 'a', true, 2, 0, 1, "<script>", [], [], true + $column, + 'a', + true, + 2, + 0, + 1, + "<script>", + [], + [], + true, ]); $this->assertEquals( @@ -742,7 +916,7 @@ class InsertEditTest extends TestCase { $column = $foreignData = []; $foreigners = [ - 'foreign_keys_data' => [] + 'foreign_keys_data' => [], ]; $column['Field'] = 'f'; $column['True_Type'] = 'enum'; @@ -750,7 +924,9 @@ class InsertEditTest extends TestCase $this->assertEquals( '1', $this->callProtectedMethod('getNullifyCodeForNullColumn', [ - $column, $foreigners, [] + $column, + $foreigners, + [], ]) ); @@ -759,7 +935,9 @@ class InsertEditTest extends TestCase $this->assertEquals( '2', $this->callProtectedMethod('getNullifyCodeForNullColumn', [ - $column, $foreigners, [] + $column, + $foreigners, + [], ]) ); @@ -767,7 +945,9 @@ class InsertEditTest extends TestCase $this->assertEquals( '3', $this->callProtectedMethod('getNullifyCodeForNullColumn', [ - $column, $foreigners, [] + $column, + $foreigners, + [], ]) ); @@ -777,7 +957,9 @@ class InsertEditTest extends TestCase $this->assertEquals( '4', $this->callProtectedMethod('getNullifyCodeForNullColumn', [ - $column, $foreigners, $foreignData + $column, + $foreigners, + $foreignData, ]) ); } @@ -794,8 +976,21 @@ class InsertEditTest extends TestCase $titles['Browse'] = "'"; $GLOBALS['cfg']['ServerDefault'] = 2; $result = $this->callProtectedMethod('getForeignLink', [ - $column, 'a', 'b', 'd', 2, 0, 1, "abc", ['tbl', 'db'], 8, - $titles, false + $column, + 'a', + 'b', + 'd', + 2, + 0, + 1, + "abc", + [ + 'tbl', + 'db', + ], + 8, + $titles, + false, ]); $this->assertContains( @@ -833,7 +1028,16 @@ class InsertEditTest extends TestCase $GLOBALS['cfg']['ForeignKeyMaxLimit'] = 1; $GLOBALS['cfg']['NaturalOrder'] = false; $result = $this->callProtectedMethod('dispRowForeignData', [ - $column, 'a', 'b', 'd', 2, 0, 1, "<s>", $foreignData, false + $column, + 'a', + 'b', + 'd', + 2, + 0, + 1, + "<s>", + $foreignData, + false, ]); $this->assertContains( @@ -869,7 +1073,16 @@ class InsertEditTest extends TestCase $GLOBALS['cfg']['ForeignKeyMaxLimit'] = 1; $GLOBALS['cfg']['NaturalOrder'] = false; $result = $this->callProtectedMethod('dispRowForeignData', [ - $column, 'a', 'b', 'd', 2, 0, 1, "<s>", $foreignData, false + $column, + 'a', + 'b', + 'd', + 2, + 0, + 1, + "<s>", + $foreignData, + false, ]); $this->assertContains( @@ -907,7 +1120,17 @@ class InsertEditTest extends TestCase $column['Type'] = 'char(10)'; $column['True_Type'] = 'char'; $result = $this->callProtectedMethod('getTextarea', [ - $column, 'a', 'b', '', 2, 0, 1, "abc/", 'foobar', 'CHAR', false + $column, + 'a', + 'b', + '', + 2, + 0, + 1, + "abc/", + 'foobar', + 'CHAR', + false, ]); $this->assertContains( @@ -931,12 +1154,20 @@ class InsertEditTest extends TestCase $column['values'] = [ [ 'html' => 'foo', - 'plain' => 'data' - ] + 'plain' => 'data', + ], ]; $result = $this->callProtectedMethod('getPmaTypeEnum', [ - $column, 'a', 'b', $extracted_columnspec, 'd', 2, 0, 1, - 'foobar', false + $column, + 'a', + 'b', + $extracted_columnspec, + 'd', + 2, + 0, + 1, + 'foobar', + false, ]); $this->assertContains( @@ -951,8 +1182,16 @@ class InsertEditTest extends TestCase $column['Type'] = 'ababababababababababa'; $result = $this->callProtectedMethod('getPmaTypeEnum', [ - $column, 'a', 'b', $extracted_columnspec, 'd', 2, 0, 1, - 'foobar', false + $column, + 'a', + 'b', + $extracted_columnspec, + 'd', + 2, + 0, + 1, + 'foobar', + false, ]); $this->assertContains( @@ -976,18 +1215,26 @@ class InsertEditTest extends TestCase { $extracted_columnspec = $column = []; $extracted_columnspec['enum_set_values'] = [ - '<abc>', '"foo"' + '<abc>', + '"foo"', ]; $column['values'] = 'abc'; $result = $this->callProtectedMethod('getColumnEnumValues', [ - $column, $extracted_columnspec + $column, + $extracted_columnspec, ]); $this->assertEquals( [ - ['plain' => '<abc>', 'html' => '<abc>'], - ['plain' => '"foo"', 'html' => '"foo"'], + [ + 'plain' => '<abc>', + 'html' => '<abc>' + ], + [ + 'plain' => '"foo"', + 'html' => '"foo"' + ], ], $result ); @@ -1003,16 +1250,24 @@ class InsertEditTest extends TestCase $column_enum_values = [ [ 'html' => 'foo', - 'plain' => 'data' + 'plain' => 'data', ], [ 'html' => 'bar', - 'plain' => '' - ] + 'plain' => '', + ], ]; $result = $this->callProtectedMethod('getDropDownDependingOnLength', [ - [], 'a', 'b', 2, 0, 1, 'data', $column_enum_values, false + [], + 'a', + 'b', + 2, + 0, + 1, + 'data', + $column_enum_values, + false, ]); $this->assertContains( @@ -1035,15 +1290,23 @@ class InsertEditTest extends TestCase $column_enum_values = [ [ 'html' => 'foo', - 'plain' => 'data' - ] + 'plain' => 'data', + ], ]; $column = []; $column['Default'] = 'data'; $column['Null'] = 'YES'; $result = $this->callProtectedMethod('getDropDownDependingOnLength', [ - $column, 'a', 'b', 2, 0, 1, '', $column_enum_values, false + $column, + 'a', + 'b', + 2, + 0, + 1, + '', + $column_enum_values, + false, ]); $this->assertContains( @@ -1062,16 +1325,24 @@ class InsertEditTest extends TestCase $column_enum_values = [ [ 'html' => 'foo', - 'plain' => 'data' + 'plain' => 'data', ], [ 'html' => 'bar', - 'plain' => '' - ] + 'plain' => '', + ], ]; $result = $this->callProtectedMethod('getRadioButtonDependingOnLength', [ - 'a', 'b', 2, [], 0, 1, 'data', $column_enum_values, false + 'a', + 'b', + 2, + [], + 0, + 1, + 'data', + $column_enum_values, + false, ]); $this->assertContains( @@ -1100,15 +1371,23 @@ class InsertEditTest extends TestCase $column_enum_values = [ [ 'html' => 'foo', - 'plain' => 'data' - ] + 'plain' => 'data', + ], ]; $column = []; $column['Default'] = 'data'; $column['Null'] = 'YES'; $result = $this->callProtectedMethod('getRadioButtonDependingOnLength', [ - 'a', 'b', 2, $column, 0, 1, '', $column_enum_values, false + 'a', + 'b', + 2, + $column, + 0, + 1, + '', + $column_enum_values, + false, ]); $this->assertContains( @@ -1129,14 +1408,23 @@ class InsertEditTest extends TestCase $column['values'] = [ [ 'html' => '<', - 'plain' => '<' - ] + 'plain' => '<', + ], ]; $column['select_size'] = 1; $result = $this->callProtectedMethod('getPmaTypeSet', [ - $column, [], 'a', 'b', 'c', 2, 0, 1, 'data,<', false + $column, + [], + 'a', + 'b', + 'c', + 2, + 0, + 1, + 'data,<', + false, ]); $this->assertContains("a\n", $result); @@ -1166,32 +1454,49 @@ class InsertEditTest extends TestCase public function testGetColumnSetValueAndSelectSize() { $extracted_columnspec = $column = []; - $extracted_columnspec['enum_set_values'] = ['a', '<']; + $extracted_columnspec['enum_set_values'] = [ + 'a', + '<', + ]; $result = $this->callProtectedMethod('getColumnSetValueAndSelectSize', [ - [], $extracted_columnspec + [], + $extracted_columnspec, ]); $this->assertEquals( [ [ - ['plain' => 'a', 'html' => 'a'], - ['plain' => '<', 'html' => '<'] + [ + 'plain' => 'a', + 'html' => 'a' + ], + [ + 'plain' => '<', + 'html' => '<' + ], ], - 2 + 2, ], $result ); - $column['values'] = [1, 2]; + $column['values'] = [ + 1, + 2, + ]; $column['select_size'] = 3; $result = $this->callProtectedMethod('getColumnSetValueAndSelectSize', [ - $column, $extracted_columnspec + $column, + $extracted_columnspec, ]); $this->assertEquals( [ - [1, 2], - 3 + [ + 1, + 2, + ], + 3, ], $result ); @@ -1214,8 +1519,21 @@ class InsertEditTest extends TestCase $GLOBALS['max_upload_size'] = 65536; $result = $this->callProtectedMethod('getBinaryAndBlobColumn', [ - $column, '12\\"23', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null, - 'foo', true, false + $column, + '12\\"23', + null, + 20, + 'a', + 'b', + 'c', + 2, + 1, + 1, + '/', + null, + 'foo', + true, + false, ]); $this->assertEquals( @@ -1232,8 +1550,21 @@ class InsertEditTest extends TestCase $column['is_binary'] = true; $result = $this->callProtectedMethod('getBinaryAndBlobColumn', [ - $column, '1223', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null, - 'foo', false, false + $column, + '1223', + null, + 20, + 'a', + 'b', + 'c', + 2, + 1, + 1, + '/', + null, + 'foo', + false, + false, ]); $this->assertEquals( @@ -1248,8 +1579,21 @@ class InsertEditTest extends TestCase $column['is_blob'] = false; $result = $this->callProtectedMethod('getBinaryAndBlobColumn', [ - $column, '1223', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null, - 'foo', true, false + $column, + '1223', + null, + 20, + 'a', + 'b', + 'c', + 2, + 1, + 1, + '/', + null, + 'foo', + true, + false, ]); $this->assertEquals( @@ -1271,8 +1615,21 @@ class InsertEditTest extends TestCase $GLOBALS['cfg']['LimitChars'] = 100; $result = $this->callProtectedMethod('getBinaryAndBlobColumn', [ - $column, '1223', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null, - 'foo', true, false + $column, + '1223', + null, + 20, + 'a', + 'b', + 'c', + 2, + 1, + 1, + '/', + null, + 'foo', + true, + false, ]); $this->assertEquals( @@ -1296,8 +1653,21 @@ class InsertEditTest extends TestCase $GLOBALS['cfg']['TextareaCols'] = 10; $result = $this->callProtectedMethod('getBinaryAndBlobColumn', [ - $column, '1223', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null, - 'foo', true, false + $column, + '1223', + null, + 20, + 'a', + 'b', + 'c', + 2, + 1, + 1, + '/', + null, + 'foo', + true, + false, ]); $this->assertEquals( @@ -1322,8 +1692,21 @@ class InsertEditTest extends TestCase */ $result = $this->callProtectedMethod('getBinaryAndBlobColumn', [ - $column, '1223', null, 20, 'a', 'b', 'c', 2, 1, 1, '/', null, - 'foo', true, false + $column, + '1223', + null, + 20, + 'a', + 'b', + 'c', + 2, + 1, + 1, + '/', + null, + 'foo', + true, + false, ]); $this->assertEquals( @@ -1347,7 +1730,16 @@ class InsertEditTest extends TestCase $column['pma_type'] = 'date'; $column['True_Type'] = 'date'; $result = $this->callProtectedMethod('getHtmlInput', [ - $column, 'a', 'b', 30, 'c', 23, 2, 0, 'DATE', false + $column, + 'a', + 'b', + 30, + 'c', + 23, + 2, + 0, + 'DATE', + false, ]); $this->assertEquals( @@ -1360,7 +1752,16 @@ class InsertEditTest extends TestCase $column['pma_type'] = 'datetime'; $column['True_Type'] = 'datetime'; $result = $this->callProtectedMethod('getHtmlInput', [ - $column, 'a', 'b', 30, 'c', 23, 2, 0, 'DATE', false + $column, + 'a', + 'b', + 30, + 'c', + 23, + 2, + 0, + 'DATE', + false, ]); $this->assertEquals( '<input type="text" name="fieldsa" value="b" size="30" data-type="DATE"' @@ -1372,7 +1773,16 @@ class InsertEditTest extends TestCase $column['pma_type'] = 'timestamp'; $column['True_Type'] = 'timestamp'; $result = $this->callProtectedMethod('getHtmlInput', [ - $column, 'a', 'b', 30, 'c', 23, 2, 0, 'DATE', false + $column, + 'a', + 'b', + 30, + 'c', + 23, + 2, + 0, + 'DATE', + false, ]); $this->assertEquals( '<input type="text" name="fieldsa" value="b" size="30" data-type="DATE"' @@ -1392,11 +1802,15 @@ class InsertEditTest extends TestCase $column = []; $column['pma_type'] = 'tinyblob'; $result = $this->callProtectedMethod('getMaxUploadSize', [ - $column, 256 + $column, + 256, ]); $this->assertEquals( - ["(Max: 256B)\n", 256], + [ + "(Max: 256B)\n", + 256, + ], $result ); @@ -1404,11 +1818,15 @@ class InsertEditTest extends TestCase $GLOBALS['max_upload_size'] = 250; $column['pma_type'] = 'tinyblob'; $result = $this->callProtectedMethod('getMaxUploadSize', [ - $column, 20 + $column, + 20, ]); $this->assertEquals( - ["(Max: 250B)\n", 250], + [ + "(Max: 250B)\n", + 250, + ], $result ); } @@ -1438,8 +1856,20 @@ class InsertEditTest extends TestCase $extracted_columnspec = []; $extracted_columnspec['spec_in_brackets'] = 25; $result = $this->callProtectedMethod('getValueColumnForOtherDatatypes', [ - $column, 'defchar', 'a', 'b', 'c', 22, '<', 12, 1, "/", "<", - "foo\nbar", $extracted_columnspec, false + $column, + 'defchar', + 'a', + 'b', + 'c', + 22, + '<', + 12, + 1, + "/", + "<", + "foo\nbar", + $extracted_columnspec, + false, ]); $this->assertEquals( @@ -1457,8 +1887,20 @@ class InsertEditTest extends TestCase $column['pma_type'] = 'timestamp'; $column['True_Type'] = 'timestamp'; $result = $this->callProtectedMethod('getValueColumnForOtherDatatypes', [ - $column, 'defchar', 'a', 'b', 'c', 22, '<', 12, 1, "/", "<", - "foo\nbar", $extracted_columnspec, false + $column, + 'defchar', + 'a', + 'b', + 'c', + 22, + '<', + 12, + 1, + "/", + "<", + "foo\nbar", + $extracted_columnspec, + false, ]); $this->assertEquals( @@ -1473,8 +1915,20 @@ class InsertEditTest extends TestCase // case 3: (else -> datetime) $column['pma_type'] = 'datetime'; $result = $this->callProtectedMethod('getValueColumnForOtherDatatypes', [ - $column, 'defchar', 'a', 'b', 'c', 22, '<', 12, 1, "/", "<", - "foo\nbar", $extracted_columnspec, false + $column, + 'defchar', + 'a', + 'b', + 'c', + 22, + '<', + 12, + 1, + "/", + "<", + "foo\nbar", + $extracted_columnspec, + false, ]); $this->assertContains( @@ -1499,7 +1953,8 @@ class InsertEditTest extends TestCase $this->assertEquals( 40, $this->callProtectedMethod('getColumnSize', [ - $column, $extracted_columnspec + $column, + $extracted_columnspec, ]) ); @@ -1514,7 +1969,8 @@ class InsertEditTest extends TestCase $this->assertEquals( 30, $this->callProtectedMethod('getColumnSize', [ - $column, $extracted_columnspec + $column, + $extracted_columnspec, ]) ); } @@ -1629,7 +2085,9 @@ class InsertEditTest extends TestCase public function testGetSubmitTypeDropDown() { $result = $this->callProtectedMethod('getSubmitTypeDropDown', [ - [], 2, 2 + [], + 2, + 2, ]); $this->assertContains( @@ -1651,7 +2109,9 @@ class InsertEditTest extends TestCase public function testGetAfterInsertDropDown() { $result = $this->callProtectedMethod('getAfterInsertDropDown', [ - "`t`.`f` = 2", 'new_insert', true + "`t`.`f` = 2", + 'new_insert', + true, ]); $this->assertContains( @@ -1679,7 +2139,8 @@ class InsertEditTest extends TestCase { $GLOBALS['cfg']['ShowHint'] = false; $result = $this->callProtectedMethod('getSubmitAndResetButtonForActionsPanel', [ - 1, 0 + 1, + 0, ]); $this->assertContains( @@ -1743,7 +2204,13 @@ class InsertEditTest extends TestCase $column['Extra'] = 'fooauto_increment'; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForExistingRow', [ - $current_row, $column, [], false, [], 'a', false + $current_row, + $column, + [], + false, + [], + 'a', + false, ]); $this->assertEquals( @@ -1752,7 +2219,7 @@ class InsertEditTest extends TestCase null, null, null, - '<input type="hidden" name="fields_preva" value="">' + '<input type="hidden" name="fields_preva" value="">', ], $result ); @@ -1765,7 +2232,13 @@ class InsertEditTest extends TestCase $column['True_Type'] = 'bit'; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForExistingRow', [ - $current_row, $column, $extracted_columnspec, false, [], 'a', false + $current_row, + $column, + $extracted_columnspec, + false, + [], + 'a', + false, ]); $this->assertEquals( @@ -1774,14 +2247,20 @@ class InsertEditTest extends TestCase "", "00000000000001111011", null, - '<input type="hidden" name="fields_preva" value="123">' + '<input type="hidden" name="fields_preva" value="123">', ], $result ); $current_row['f'] = "abcd"; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForExistingRow', [ - $current_row, $column, $extracted_columnspec, false, [], 'a', true + $current_row, + $column, + $extracted_columnspec, + false, + [], + 'a', + true, ]); $this->assertEquals( @@ -1790,7 +2269,7 @@ class InsertEditTest extends TestCase "", "abcd", null, - '<input type="hidden" name="fields_preva" value="abcd">' + '<input type="hidden" name="fields_preva" value="abcd">', ], $result ); @@ -1808,8 +2287,13 @@ class InsertEditTest extends TestCase $column['True_Type'] = 'int'; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForExistingRow', [ - $current_row, $column, $extracted_columnspec, - false, ['int'], 'a', false + $current_row, + $column, + $extracted_columnspec, + false, + ['int'], + 'a', + false, ]); $this->assertEquals( @@ -1818,7 +2302,7 @@ class InsertEditTest extends TestCase "", "'',", null, - '<input type="hidden" name="fields_preva" value="\'\',">' + '<input type="hidden" name="fields_preva" value="\'\',">', ], $result ); @@ -1833,8 +2317,13 @@ class InsertEditTest extends TestCase $GLOBALS['cfg']['ShowFunctionFields'] = true; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForExistingRow', [ - $current_row, $column, $extracted_columnspec, - false, ['int'], 'a', false + $current_row, + $column, + $extracted_columnspec, + false, + ['int'], + 'a', + false, ]); $this->assertEquals( @@ -1843,7 +2332,7 @@ class InsertEditTest extends TestCase "3131303031", "3131303031", "3131303031", - '<input type="hidden" name="fields_preva" value="3131303031">' + '<input type="hidden" name="fields_preva" value="3131303031">', ], $result ); @@ -1852,8 +2341,13 @@ class InsertEditTest extends TestCase $current_row['f'] = "11001\x00"; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForExistingRow', [ - $current_row, $column, $extracted_columnspec, - false, ['int'], 'a', false + $current_row, + $column, + $extracted_columnspec, + false, + ['int'], + 'a', + false, ]); $this->assertEquals( @@ -1862,7 +2356,7 @@ class InsertEditTest extends TestCase "313130303100", "313130303100", "313130303100", - '<input type="hidden" name="fields_preva" value="313130303100">' + '<input type="hidden" name="fields_preva" value="313130303100">', ], $result ); @@ -1883,7 +2377,8 @@ class InsertEditTest extends TestCase $GLOBALS['cfg']['ShowFunctionFields'] = true; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForInsertingMode', [ - $column, false + $column, + false, ]); $this->assertEquals( @@ -1892,7 +2387,7 @@ class InsertEditTest extends TestCase '101', '101', '', - '101' + '101', ], $result ); @@ -1902,7 +2397,8 @@ class InsertEditTest extends TestCase $column['True_Type'] = 'char'; $result = $this->callProtectedMethod('getSpecialCharsAndBackupFieldForInsertingMode', [ - $column, false + $column, + false, ]); $this->assertEquals( @@ -1911,7 +2407,7 @@ class InsertEditTest extends TestCase '', '', '', - '' + '', ], $result ); @@ -1934,22 +2430,28 @@ class InsertEditTest extends TestCase ['LIMIT 1'], true, true, - false + false, ], $result ); // case 2 (else) unset($_POST['where_clause']); - $_POST['fields']['multi_edit'] = ['a' => 'b', 'c' => 'd']; + $_POST['fields']['multi_edit'] = [ + 'a' => 'b', + 'c' => 'd', + ]; $result = $this->insertEdit->getParamsForUpdateOrInsert(); $this->assertEquals( [ - ['a', 'c'], + [ + 'a', + 'c', + ], false, true, - false + false, ], $result ); @@ -2120,8 +2622,14 @@ class InsertEditTest extends TestCase { $GLOBALS['db'] = 'db'; $GLOBALS['table'] = 'table'; - $query_fields = ['a', 'b']; - $value_sets = [1, 2]; + $query_fields = [ + 'a', + 'b', + ]; + $value_sets = [ + 1, + 2, + ]; $this->assertEquals( ['INSERT IGNORE INTO `table` (a, b) VALUES (1), (2)'], @@ -2141,7 +2649,10 @@ class InsertEditTest extends TestCase */ public function testExecuteSqlQuery() { - $query = ['SELECT 1', 'SELECT 2']; + $query = [ + 'SELECT 1', + 'SELECT 2', + ]; $GLOBALS['sql_query'] = 'SELECT'; $GLOBALS['cfg']['IgnoreMultiSubmitErrors'] = false; $_POST['submit_type'] = ''; @@ -2228,7 +2739,10 @@ class InsertEditTest extends TestCase */ public function testExecuteSqlQueryWithTryQuery() { - $query = ['SELECT 1', 'SELECT 2']; + $query = [ + 'SELECT 1', + 'SELECT 2', + ]; $GLOBALS['sql_query'] = 'SELECT'; $GLOBALS['cfg']['IgnoreMultiSubmitErrors'] = true; $_POST['submit_type'] = ''; @@ -2316,8 +2830,16 @@ class InsertEditTest extends TestCase public function testGetWarningMessages() { $warnings = [ - ['Level' => 1, 'Code' => 42, 'Message' => 'msg1'], - ['Level' => 2, 'Code' => 43, 'Message' => 'msg2'], + [ + 'Level' => 1, + 'Code' => 42, + 'Message' => 'msg1', + ], + [ + 'Level' => 2, + 'Code' => 43, + 'Message' => 'msg2', + ], ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -2336,7 +2858,7 @@ class InsertEditTest extends TestCase $this->assertEquals( [ "1: #42 msg1", - "2: #43 msg2" + "2: #43 msg2", ], $result ); @@ -2428,13 +2950,16 @@ class InsertEditTest extends TestCase public function testTransformEditedValues() { $edited_values = [ - ['c' => 'cname'] + ['c' => 'cname'], + ]; + $GLOBALS['cfg']['DefaultTransformations']['PreApPend'] = [ + '', + '', ]; - $GLOBALS['cfg']['DefaultTransformations']['PreApPend'] = ['', '']; $GLOBALS['cfg']['ServerDefault'] = 1; $_POST['where_clause'] = 1; $transformation = [ - 'transformation_options' => "'','option ,, quoted',abd" + 'transformation_options' => "'','option ,, quoted',abd", ]; $result = $this->insertEdit->transformEditedValues( 'db', @@ -2448,7 +2973,10 @@ class InsertEditTest extends TestCase ); $this->assertEquals( - ['a' => 'b', 'transformations' => ["cnameoption ,, quoted"]], + [ + 'a' => 'b', + 'transformations' => ["cnameoption ,, quoted"], + ], $result ); } @@ -2479,8 +3007,14 @@ class InsertEditTest extends TestCase $this->assertEquals( [ - [1, 'foo'], - [2, '`fld`'] + [ + 1, + 'foo', + ], + [ + 2, + '`fld`', + ], ], $result ); @@ -2502,8 +3036,11 @@ class InsertEditTest extends TestCase $this->assertEquals( [ - [1, '`fld` = foo'], - [2] + [ + 1, + '`fld` = foo', + ], + [2], ], $result ); @@ -2526,7 +3063,7 @@ class InsertEditTest extends TestCase $this->assertEquals( [ [1], - [2] + [2], ], $result ); @@ -2548,8 +3085,11 @@ class InsertEditTest extends TestCase $this->assertEquals( [ - [1, '`fld` = foo'], - [2] + [ + 1, + '`fld` = foo', + ], + [2], ], $result ); @@ -3036,7 +3576,10 @@ class InsertEditTest extends TestCase $result = $this->insertEdit->getTableColumns('db', 'table'); $this->assertEquals( - ['b', 'd'], + [ + 'b', + 'd', + ], $result ); } @@ -3085,7 +3628,7 @@ class InsertEditTest extends TestCase [null], [null], false, - "edit_next" + "edit_next", ], $result ); @@ -3106,9 +3649,12 @@ class InsertEditTest extends TestCase [], null, null, - [false, false], + [ + false, + false, + ], false, - "edit_next" + "edit_next", ], $result ); @@ -3132,7 +3678,12 @@ class InsertEditTest extends TestCase ->with('db', 'table', null, true) ->will( $this->returnValue( - [['Comment' => 'b', 'Field' => 'd']] + [ + [ + 'Comment' => 'b', + 'Field' => 'd' + ], + ] ) ); @@ -3217,23 +3768,47 @@ class InsertEditTest extends TestCase 'Field' => 'col', 'Type' => 'varchar(20)', 'Null' => 'Yes', - 'Privileges' => 'insert,update,select' - ] + 'Privileges' => 'insert,update,select', + ], ]; $repopulate = [ - md5('col') => 'val' + md5('col') => 'val', ]; $column_mime = [ 'input_transformation' => 'Input/Image_JPEG_Upload.php', - 'input_transformation_options' => '150' + 'input_transformation_options' => '150', ]; // Test w/ input transformation $actual = $this->callProtectedMethod('getHtmlForInsertEditFormColumn', [ - $table_columns, 0, [], false, [], '', '', - '', false, [], &$o_rows, &$tabindex, 0, false, 0, - [], 0, 0, 'table', 'db', 0, [], 0, '', '', - $repopulate, $column_mime, '' + $table_columns, + 0, + [], + false, + [], + '', + '', + '', + false, + [], + &$o_rows, + &$tabindex, + 0, + false, + 0, + [], + 0, + 0, + 'table', + 'db', + 0, + [], + 0, + '', + '', + $repopulate, + $column_mime, + '', ]); $this->assertContains( @@ -3279,17 +3854,41 @@ class InsertEditTest extends TestCase 'Key' => '', 'Extra' => '', 'Default' => null, - 'Privileges' => 'insert,update,select' - ] + 'Privileges' => 'insert,update,select', + ], ]; $repopulate = [ - md5('qwerty') => '12-10-14' + md5('qwerty') => '12-10-14', ]; $actual = $this->callProtectedMethod('getHtmlForInsertEditFormColumn', [ - $table_columns, 0, [], false, [], '', '', - '', true, [], &$o_rows, &$tabindex, 0, false, 0, - [], 0, 0, 'table', 'db', 0, [], 0, '', '', - $repopulate, [], '' + $table_columns, + 0, + [], + false, + [], + '', + '', + '', + true, + [], + &$o_rows, + &$tabindex, + 0, + false, + 0, + [], + 0, + 0, + 'table', + 'db', + 0, + [], + 0, + '', + '', + $repopulate, + [], + '', ]); $this->assertContains( 'qwerty', @@ -3331,7 +3930,7 @@ class InsertEditTest extends TestCase 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,insert,update,references', - ] + ], ]; $actual = $this->insertEdit->getHtmlForInsertEditRow( [], @@ -3417,7 +4016,7 @@ class InsertEditTest extends TestCase 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,insert,references', - ] + ], ]; $actual = $this->insertEdit->getHtmlForInsertEditRow( [], @@ -3475,7 +4074,7 @@ class InsertEditTest extends TestCase 'pma_type' => 'longtext', 'True_Type' => 'longtext', 'Privileges' => 'select,update,references', - ] + ], ]; $actual = $this->insertEdit->getHtmlForInsertEditRow( [], diff --git a/test/classes/IpAllowDenyTest.php b/test/classes/IpAllowDenyTest.php index 44821c9229..a109b45785 100644 --- a/test/classes/IpAllowDenyTest.php +++ b/test/classes/IpAllowDenyTest.php @@ -101,17 +101,42 @@ class IpAllowDenyTest extends TestCase { return [ // Nothing set - [null, null, false], + [ + null, + null, + false, + ], // Remote IP set - ['101.0.0.25', null, '101.0.0.25'], + [ + '101.0.0.25', + null, + '101.0.0.25', + ], // Proxy - ['101.0.0.25', '192.168.10.10', '192.168.10.10'], + [ + '101.0.0.25', + '192.168.10.10', + '192.168.10.10', + ], // Several proxies - ['101.0.0.25', '192.168.10.1, 192.168.100.100', '192.168.10.1'], + [ + '101.0.0.25', + '192.168.10.1, 192.168.100.100', + '192.168.10.1', + ], // Invalid proxy - ['101.0.0.25', 'invalid', false], + [ + '101.0.0.25', + 'invalid', + false, + ], // Direct IP with proxy enabled - ['101.0.0.25', '192.168.10.10', '101.0.0.25', '10.10.10.10'], + [ + '101.0.0.25', + '192.168.10.10', + '101.0.0.25', + '10.10.10.10', + ], ]; } diff --git a/test/classes/LanguageTest.php b/test/classes/LanguageTest.php index e480e0b307..d8191f9208 100644 --- a/test/classes/LanguageTest.php +++ b/test/classes/LanguageTest.php @@ -195,19 +195,96 @@ class LanguageTest extends PmaTestCase public function selectDataProvider() { return [ - ['cs', 'en', '', '' ,'' ,'', '', 'Czech'], - ['', 'cs', '', '' ,'' ,'', '', 'Czech'], - ['', 'cs', 'en', '' ,'' ,'', '', 'Czech'], - ['', '', 'cs', '' ,'' ,'', '', 'Czech'], - ['', '', '', 'cs' ,'' ,'', '', 'Czech'], - ['', '', '', '' ,'cs,en-US;q=0.7,en;q=0.3' ,'', '', 'Czech'], [ - '', '', '', '', '', + 'cs', + 'en', + '', + '', + '', + '', + '', + 'Czech', + ], + [ + '', + 'cs', + '', + '', + '', + '', + '', + 'Czech', + ], + [ + '', + 'cs', + 'en', + '', + '', + '', + '', + 'Czech', + ], + [ + '', + '', + 'cs', + '', + '', + '', + '', + 'Czech', + ], + [ + '', + '', + '', + 'cs', + '', + '', + '', + 'Czech', + ], + [ + '', + '', + '', + '', + 'cs,en-US;q=0.7,en;q=0.3', + '', + '', + 'Czech', + ], + [ + '', + '', + '', + '', + '', 'Mozilla/5.0 (Linux; U; Android 2.2.2; tr-tr; GM FOX)', - '', 'Turkish' + '', + 'Turkish', + ], + [ + '', + '', + '', + '', + '', + '', + 'cs', + 'Czech', + ], + [ + '', + '', + '', + '', + '', + '', + '', + 'English', ], - ['', '', '', '' ,'' ,'', 'cs', 'Czech'], - ['', '', '', '' ,'' ,'', '', 'English'], ]; } diff --git a/test/classes/LinterTest.php b/test/classes/LinterTest.php index 344c075dcb..215df558bb 100644 --- a/test/classes/LinterTest.php +++ b/test/classes/LinterTest.php @@ -50,19 +50,31 @@ class LinterTest extends PmaTestCase // ( d, 4), ( e, 5), (\n, 6), // (\n, 7). $this->assertEquals( - [1, 0], + [ + 1, + 0, + ], Linter::findLineNumberAndColumn([0, 4, 7], 4) ); $this->assertEquals( - [1, 1], + [ + 1, + 1, + ], Linter::findLineNumberAndColumn([0, 4, 7], 5) ); $this->assertEquals( - [1, 2], + [ + 1, + 2, + ], Linter::findLineNumberAndColumn([0, 4, 7], 6) ); $this->assertEquals( - [2, 0], + [ + 2, + 0, + ], Linter::findLineNumberAndColumn([0, 4, 7], 7) ); } @@ -96,7 +108,7 @@ class LinterTest extends PmaTestCase ], [ [], - 'SELECT * FROM tbl' + 'SELECT * FROM tbl', ], [ [ @@ -117,9 +129,9 @@ class LinterTest extends PmaTestCase 'toLine' => 0, 'toColumn' => 24, 'severity' => 'error', - ] + ], ], - 'CREATE TABLE tbl ( id IN' + 'CREATE TABLE tbl ( id IN', ], [ [ @@ -131,10 +143,10 @@ class LinterTest extends PmaTestCase 'toLine' => 0, 'toColumn' => 0, 'severity' => 'warning', - ] + ], ], - str_repeat(";", 10001) - ] + str_repeat(";", 10001), + ], ]; } } diff --git a/test/classes/MessageTest.php b/test/classes/MessageTest.php index 5d912b1ac7..64bc35a145 100644 --- a/test/classes/MessageTest.php +++ b/test/classes/MessageTest.php @@ -215,12 +215,19 @@ class MessageTest extends PmaTestCase ); $this->object->addParam('test'); $this->assertEquals( - [Message::notice('test'), 'test'], + [ + Message::notice('test'), + 'test', + ], $this->object->getParams() ); $this->object->addParam('test'); $this->assertEquals( - [Message::notice('test'), 'test', Message::notice('test')], + [ + Message::notice('test'), + 'test', + Message::notice('test'), + ], $this->object->getParams() ); } @@ -251,7 +258,10 @@ class MessageTest extends PmaTestCase { $this->object->addText('test', '*'); $this->assertEquals( - ['*', Message::notice('test')], + [ + '*', + Message::notice('test'), + ], $this->object->getAddedMessages() ); $this->object->addText('test', ''); @@ -259,7 +269,7 @@ class MessageTest extends PmaTestCase [ '*', Message::notice('test'), - Message::notice('test') + Message::notice('test'), ], $this->object->getAddedMessages() ); @@ -282,7 +292,7 @@ class MessageTest extends PmaTestCase [ Message::notice('test<>'), ' ', - Message::rawNotice('<b>test</b>') + Message::rawNotice('<b>test</b>'), ], $this->object->getAddedMessages() ); @@ -310,7 +320,7 @@ class MessageTest extends PmaTestCase [ Message::notice('Test1'), Message::error("PMA_Test2"), - Message::notice('Test3') + Message::notice('Test3'), ], $this->object->getAddedMessages() ); @@ -323,14 +333,18 @@ class MessageTest extends PmaTestCase */ public function testAddMessagesString() { - $messages = ['test1', 'test<b>', 'test2']; + $messages = [ + 'test1', + 'test<b>', + 'test2', + ]; $this->object->addMessagesString($messages, ''); $this->assertEquals( [ Message::notice('test1'), Message::notice('test<b>'), - Message::notice('test2') + Message::notice('test2'), ], $this->object->getAddedMessages() ); @@ -367,7 +381,10 @@ class MessageTest extends PmaTestCase Message::sanitize($this->object) ); $this->assertEquals( - ['test&string<>', 'test&string<>'], + [ + 'test&string<>', + 'test&string<>', + ], Message::sanitize([$this->object, $this->object]) ); } @@ -382,34 +399,34 @@ class MessageTest extends PmaTestCase return [ [ '[em]test[/em][em]aa[em/][em]test[/em]', - '<em>test</em><em>aa[em/]<em>test</em>' + '<em>test</em><em>aa[em/]<em>test</em>', ], [ '[strong]test[/strong][strong]test[/strong]', - '<strong>test</strong><strong>test</strong>' + '<strong>test</strong><strong>test</strong>', ], [ '[code]test[/code][code]test[/code]', - '<code>test</code><code>test</code>' + '<code>test</code><code>test</code>', ], [ '[kbd]test[/kbd][br][sup]test[/sup]', - '<kbd>test</kbd><br><sup>test</sup>' + '<kbd>test</kbd><br><sup>test</sup>', ], [ '[a@https://example.com/@Documentation]link[/a]', '<a href="./url.php?url=https%3A%2F%2Fexample.com%2F"' - . ' target="Documentation">link</a>' + . ' target="Documentation">link</a>', ], [ '[a@./non-existing@Documentation]link[/a]', - '[a@./non-existing@Documentation]link</a>' + '[a@./non-existing@Documentation]link</a>', ], [ '[doc@foo]link[/doc]', '<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F' . 'latest%2Fsetup.html%23foo" ' - . 'target="documentation">link</a>' + . 'target="documentation">link</a>', ], ]; } @@ -588,18 +605,18 @@ class MessageTest extends PmaTestCase [ 1, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 1 row affected.</div>' + . 'class="icon ic_s_notice"> 1 row affected.</div>', ], [ 2, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 2 rows affected.</div>' + . 'class="icon ic_s_notice"> 2 rows affected.</div>', ], [ 10000, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 10000 rows affected.</div>' - ] + . 'class="icon ic_s_notice"> 10000 rows affected.</div>', + ], ]; } @@ -633,18 +650,18 @@ class MessageTest extends PmaTestCase [ 1, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 1 row inserted.</div>' + . 'class="icon ic_s_notice"> 1 row inserted.</div>', ], [ 2, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 2 rows inserted.</div>' + . 'class="icon ic_s_notice"> 2 rows inserted.</div>', ], [ 100000, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 100000 rows inserted.</div>' - ] + . 'class="icon ic_s_notice"> 100000 rows inserted.</div>', + ], ]; } @@ -678,18 +695,18 @@ class MessageTest extends PmaTestCase [ 1, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 1 row deleted.</div>' + . 'class="icon ic_s_notice"> 1 row deleted.</div>', ], [ 2, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 2 rows deleted.</div>' + . 'class="icon ic_s_notice"> 2 rows deleted.</div>', ], [ 500000, '<div class="notice"><img src="themes/dot.gif" title="" alt="" ' - . 'class="icon ic_s_notice"> 500000 rows deleted.</div>' - ] + . 'class="icon ic_s_notice"> 500000 rows deleted.</div>', + ], ]; } diff --git a/test/classes/MimeTest.php b/test/classes/MimeTest.php index 350ca0d3fc..e646a57e77 100644 --- a/test/classes/MimeTest.php +++ b/test/classes/MimeTest.php @@ -47,19 +47,19 @@ class MimeTest extends TestCase return [ [ 'pma', - 'application/octet-stream' + 'application/octet-stream', ], [ 'GIF', - 'image/gif' + 'image/gif', ], [ "\x89PNG", - 'image/png' + 'image/png', ], [ chr(0xff) . chr(0xd8), - 'image/jpeg' + 'image/jpeg', ], ]; } diff --git a/test/classes/MultSubmitsTest.php b/test/classes/MultSubmitsTest.php index dfd07e9481..1eb0c48510 100644 --- a/test/classes/MultSubmitsTest.php +++ b/test/classes/MultSubmitsTest.php @@ -198,7 +198,7 @@ class MultSubmitsTest extends TestCase $db = "PMA_db"; $table = "PMA_table"; $selected = [ - "index1" => "table1" + "index1" => "table1", ]; $views = null; $originalSqlQuery = "original_sql_query"; @@ -248,7 +248,8 @@ class MultSubmitsTest extends TestCase $db = "PMA_db"; $table = "PMA_table"; $selected = [ - "table1", "table2" + "table1", + "table2", ]; $views = null; $primary = null; @@ -328,10 +329,12 @@ class MultSubmitsTest extends TestCase $what = "drop_tbl"; $table = "PMA_table"; $selected = [ - "table1", "table2" + "table1", + "table2", ]; $views = [ - "table1", "table2" + "table1", + "table2", ]; list($fullQuery, $reload, $fullQueryViews) diff --git a/test/classes/Navigation/NavigationTest.php b/test/classes/Navigation/NavigationTest.php index 9e90cd2959..244729c4d9 100644 --- a/test/classes/Navigation/NavigationTest.php +++ b/test/classes/Navigation/NavigationTest.php @@ -126,7 +126,7 @@ class NavigationTest extends PmaTestCase $this->returnValue( [ 'item_name' => 'tableName', - 'item_type' => 'table' + 'item_type' => 'table', ] ) ); @@ -136,7 +136,7 @@ class NavigationTest extends PmaTestCase $this->returnValue( [ 'item_name' => 'viewName', - 'item_type' => 'view' + 'item_type' => 'view', ] ) ); diff --git a/test/classes/Navigation/Nodes/NodeTableTest.php b/test/classes/Navigation/Nodes/NodeTableTest.php index 8a39af7612..24b048a649 100644 --- a/test/classes/Navigation/Nodes/NodeTableTest.php +++ b/test/classes/Navigation/Nodes/NodeTableTest.php @@ -82,11 +82,26 @@ class NodeTableTest extends PmaTestCase public function providerForTestIcon() { return [ - ['structure', 'b_props'], - ['search', 'b_search'], - ['insert', 'b_insrow'], - ['sql', 'b_sql'], - ['browse', 'b_browse'], + [ + 'structure', + 'b_props', + ], + [ + 'search', + 'b_search', + ], + [ + 'insert', + 'b_insrow', + ], + [ + 'sql', + 'b_sql', + ], + [ + 'browse', + 'b_browse', + ], ]; } } diff --git a/test/classes/Navigation/Nodes/NodeTest.php b/test/classes/Navigation/Nodes/NodeTest.php index 477fec56ea..ae39b568b0 100644 --- a/test/classes/Navigation/Nodes/NodeTest.php +++ b/test/classes/Navigation/Nodes/NodeTest.php @@ -188,7 +188,10 @@ class NodeTest extends PmaTestCase $this->assertEquals($child->parents(), [$parent]); // exclude self $this->assertEquals( $child->parents(true), - [$child, $parent] + [ + $child, + $parent, + ] ); // include self } @@ -328,7 +331,10 @@ class NodeTest extends PmaTestCase unset($GLOBALS['cfg']['Server']['only_db']); // When only_db directive is present and it's an array of dbs - $GLOBALS['cfg']['Server']['only_db'] = ['onlyDbOne', 'onlyDbTwo']; + $GLOBALS['cfg']['Server']['only_db'] = [ + 'onlyDbOne', + 'onlyDbTwo', + ]; $this->assertEquals( "WHERE TRUE AND ( `SCHEMA_NAME` LIKE 'onlyDbOne' " . "OR `SCHEMA_NAME` LIKE 'onlyDbTwo' ) ", @@ -455,10 +461,10 @@ class NodeTest extends PmaTestCase ->method('fetchArray') ->willReturnOnConsecutiveCalls( [ - '0' => 'db' + '0' => 'db', ], [ - '0' => 'aa_db' + '0' => 'aa_db', ], false ); diff --git a/test/classes/NormalizationTest.php b/test/classes/NormalizationTest.php index e69c6c2942..6c875079dc 100644 --- a/test/classes/NormalizationTest.php +++ b/test/classes/NormalizationTest.php @@ -64,7 +64,7 @@ class NormalizationTest extends TestCase [ "id" => ["Type" => "integer"], "col1" => ["Type" => 'varchar(100)'], - "col2" => ["Type" => 'DATETIME'] + "col2" => ["Type" => 'DATETIME'], ] ) ); @@ -73,19 +73,35 @@ class NormalizationTest extends TestCase ->will($this->returnValue(["id", "col1", "col2"])); $map = [ [ - 'PMA_db', 'PMA_table1', DatabaseInterface::CONNECT_USER, - [] + 'PMA_db', + 'PMA_table1', + DatabaseInterface::CONNECT_USER, + [], ], [ - 'PMA_db', 'PMA_table', DatabaseInterface::CONNECT_USER, - [['Key_name' => 'PRIMARY', 'Column_name' => 'id']] + 'PMA_db', + 'PMA_table', + DatabaseInterface::CONNECT_USER, + [[ + 'Key_name' => 'PRIMARY', + 'Column_name' => 'id', + ], + ], ], [ - 'PMA_db', 'PMA_table2', DatabaseInterface::CONNECT_USER, + 'PMA_db', + 'PMA_table2', + DatabaseInterface::CONNECT_USER, [ - ['Key_name' => 'PRIMARY', 'Column_name' => 'id'], - ['Key_name' => 'PRIMARY', 'Column_name' => 'col1'] - ] + [ + 'Key_name' => 'PRIMARY', + 'Column_name' => 'id', + ], + [ + 'Key_name' => 'PRIMARY', + 'Column_name' => 'col1', + ], + ], ], ]; $dbi->expects($this->any()) @@ -340,7 +356,10 @@ class NormalizationTest extends TestCase $this->assertArrayHasKey('legendText', $result); $this->assertArrayHasKey('headText', $result); $this->assertArrayHasKey('queryError', $result); - $partialDependencies = ['id' => ['col2'], 'col1' => ['col2']]; + $partialDependencies = [ + 'id' => ['col2'], + 'col1' => ['col2'], + ]; $result1 = $this->normalization->createNewTablesFor2NF( $partialDependencies, $tablesName, @@ -368,12 +387,20 @@ class NormalizationTest extends TestCase [ 'html' => '', 'success' => true, - 'newTables' => [] + 'newTables' => [], ], $result ); - $tables = ["PMA_table" => ['col1', 'PMA_table']]; - $dependencies->PMA_table = ['col4', 'col5']; + $tables = [ + "PMA_table" => [ + 'col1', + 'PMA_table', + ], + ]; + $dependencies->PMA_table = [ + 'col4', + 'col5', + ]; $result1 = $this->normalization->getHtmlForNewTables3NF($dependencies, $tables, $db); $this->assertInternalType('array', $result1); $this->assertContains( @@ -385,13 +412,13 @@ class NormalizationTest extends TestCase 'PMA_table' => [ 'PMA_table' => [ 'pk' => 'col1', - 'nonpk' => 'col2' + 'nonpk' => 'col2', ], 'table2' => [ 'pk' => 'id', - 'nonpk' => 'col4, col5' + 'nonpk' => 'col4, col5', ] - ] + ], ], $result1['newTables'] ); @@ -411,7 +438,12 @@ class NormalizationTest extends TestCase $cols1 = new stdClass(); $cols1->pk = 'col2'; $cols1->nonpk = 'col3, col4'; - $newTables = ['PMA_table' => ['PMA_table' => $cols, 'table1' => $cols1]]; + $newTables = [ + 'PMA_table' => [ + 'PMA_table' => $cols, + 'table1' => $cols1 + ], + ]; $result = $this->normalization->createNewTablesFor3NF( $newTables, $db @@ -551,10 +583,22 @@ class NormalizationTest extends TestCase $method = $class->getMethod('getAllCombinationPartialKeys'); $method->setAccessible(true); - $primaryKey = ['id', 'col1', 'col2']; + $primaryKey = [ + 'id', + 'col1', + 'col2', + ]; $result = $method->invokeArgs($this->normalization, [$primaryKey]); $this->assertEquals( - ['', 'id', 'col1', 'col1,id', 'col2', 'col2,id', 'col2,col1'], + [ + '', + 'id', + 'col1', + 'col1,id', + 'col2', + 'col2,id', + 'col2,col1', + ], $result ); } diff --git a/test/classes/OperationsTest.php b/test/classes/OperationsTest.php index 876fe9dc06..c7b0b5a2f5 100644 --- a/test/classes/OperationsTest.php +++ b/test/classes/OperationsTest.php @@ -147,7 +147,10 @@ class OperationsTest extends TestCase $this->assertRegExp( '/.*tbl_operations.php(.|[\n])*Alter table order by([\n]|.)*order_order.*/m', $this->operations->getHtmlForOrderTheTable( - [['Field' => "column1"], ['Field' => "column2"]] + [ + ['Field' => "column1"], + ['Field' => "column2"], + ] ) ); } @@ -180,9 +183,12 @@ class OperationsTest extends TestCase $method->setAccessible(true); $result = $method->invokeArgs($this->operations, [ 'post', - ['name' => 'foo', 'value' => 'bar'], + [ + 'name' => 'foo', + 'value' => 'bar', + ], [], - 'doclink' + 'doclink', ]); $this->assertRegExp( @@ -235,8 +241,14 @@ class OperationsTest extends TestCase public function testGetHtmlForPartitionMaintenance() { $html = $this->operations->getHtmlForPartitionMaintenance( - ["partition1", "partion2"], - ["param1" => 'foo', "param2" => 'bar'] + [ + "partition1", + "partion2", + ], + [ + "param1" => 'foo', + "param2" => 'bar', + ] ); $this->assertRegExp('/.*action="tbl_operations.php".*/', $html); $this->assertRegExp('/.*ANALYZE.*/', $html); @@ -258,10 +270,13 @@ class OperationsTest extends TestCase [ 'foreign_db' => 'db1', 'foreign_table' => "foreign1", - 'foreign_field' => "foreign2" - ] + 'foreign_field' => "foreign2", + ], ], - ["param1" => 'a', "param2" => 'b'] + [ + "param1" => 'a', + "param2" => 'b', + ] ) ); } diff --git a/test/classes/Plugins/Auth/AuthenticationCookieTest.php b/test/classes/Plugins/Auth/AuthenticationCookieTest.php index 80c2062e86..4cad6483ae 100644 --- a/test/classes/Plugins/Auth/AuthenticationCookieTest.php +++ b/test/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -123,7 +123,7 @@ class AuthenticationCookieTest extends PmaTestCase 'setBodyId', 'setTitle', 'disableMenuAndConsole', - 'disableWarnings' + 'disableWarnings', ] ) ->getMock(); @@ -157,7 +157,10 @@ class AuthenticationCookieTest extends PmaTestCase ->will($this->returnValue($mockHeader)); $GLOBALS['pmaThemeImage'] = 'test'; - $GLOBALS['cfg']['Servers'] = [1, 2]; + $GLOBALS['cfg']['Servers'] = [ + 1, + 2, + ]; // mock error handler @@ -372,7 +375,11 @@ class AuthenticationCookieTest extends PmaTestCase public function testAuthHeaderPartial() { $GLOBALS['cfg']['LoginCookieDeleteAll'] = false; - $GLOBALS['cfg']['Servers'] = [1, 2, 3]; + $GLOBALS['cfg']['Servers'] = [ + 1, + 2, + 3, + ]; $GLOBALS['cfg']['Server']['LogoutURL'] = 'https://example.com/logout'; $GLOBALS['cfg']['Server']['auth_type'] = 'cookie'; diff --git a/test/classes/Plugins/Auth/AuthenticationHttpTest.php b/test/classes/Plugins/Auth/AuthenticationHttpTest.php index 7e30963b17..d1b40f20d3 100644 --- a/test/classes/Plugins/Auth/AuthenticationHttpTest.php +++ b/test/classes/Plugins/Auth/AuthenticationHttpTest.php @@ -82,7 +82,12 @@ class AuthenticationHttpTest extends PmaTestCase $mockHeader = $this->getMockBuilder('PhpMyAdmin\Header') ->disableOriginalConstructor() ->setMethods( - ['setBodyId', 'setTitle', 'disableMenuAndConsole', 'addHTML'] + [ + 'setBodyId', + 'setTitle', + 'disableMenuAndConsole', + 'addHTML', + ] ) ->getMock(); @@ -262,7 +267,7 @@ class AuthenticationHttpTest extends PmaTestCase false, '', 'bar', - 'foo' + 'foo', ], [ 'Basic ' . base64_encode('foobar'), @@ -271,7 +276,7 @@ class AuthenticationHttpTest extends PmaTestCase 'REMOTE_PASSWORD', true, 'Basic Zm9vYmFy', - 'pswd' + 'pswd', ], [ 'Basic ' . base64_encode('foobar:'), @@ -280,7 +285,7 @@ class AuthenticationHttpTest extends PmaTestCase 'AUTH_PASSWORD', true, 'foobar', - false + false, ], [ 'Basic ' . base64_encode(':foobar'), @@ -289,7 +294,7 @@ class AuthenticationHttpTest extends PmaTestCase 'AUTH_PASSWORD', true, 'Basic OmZvb2Jhcg==', - 'pswd' + 'pswd', ], [ 'BasicTest', @@ -298,7 +303,7 @@ class AuthenticationHttpTest extends PmaTestCase 'AUTH_PASSWORD', true, 'BasicTest', - 'pswd' + 'pswd', ], ]; } @@ -352,7 +357,7 @@ class AuthenticationHttpTest extends PmaTestCase $GLOBALS['cfg']['Server'] = [ 'host' => 'a', - 'user' => 'user2' + 'user' => 'user2', ]; $this->assertTrue( @@ -385,7 +390,7 @@ class AuthenticationHttpTest extends PmaTestCase $GLOBALS['cfg']['Server'] = [ 'host' => 'a', - 'user' => 'user2' + 'user' => 'user2', ]; $this->assertTrue( diff --git a/test/classes/Plugins/Export/ExportCodegenTest.php b/test/classes/Plugins/Export/ExportCodegenTest.php index fc880f0357..89c18bb7a9 100644 --- a/test/classes/Plugins/Export/ExportCodegenTest.php +++ b/test/classes/Plugins/Export/ExportCodegenTest.php @@ -70,7 +70,7 @@ class ExportCodegenTest extends PmaTestCase $this->assertEquals( [ "NHibernate C# DO", - "NHibernate XML" + "NHibernate XML", ], $attrCgFormats->getValue($this->object) ); @@ -78,7 +78,7 @@ class ExportCodegenTest extends PmaTestCase $this->assertEquals( [ "_handleNHibernateCSBody", - "_handleNHibernateXMLBody" + "_handleNHibernateXMLBody", ], $attrCgHandlers->getValue($this->object) ); @@ -183,7 +183,7 @@ class ExportCodegenTest extends PmaTestCase $this->assertEquals( [ "NHibernate C# DO", - "NHibernate XML" + "NHibernate XML", ], $select->getValues() ); @@ -464,7 +464,10 @@ class ExportCodegenTest extends PmaTestCase $setter->invoke($this->object, [1, 2]); $this->assertEquals( - [1, 2], + [ + 1, + 2, + ], $getter->invoke($this->object) ); } @@ -489,7 +492,10 @@ class ExportCodegenTest extends PmaTestCase $setter->invoke($this->object, [1, 2]); $this->assertEquals( - [1, 2], + [ + 1, + 2, + ], $getter->invoke($this->object) ); } diff --git a/test/classes/Plugins/Export/ExportExcelTest.php b/test/classes/Plugins/Export/ExportExcelTest.php index 11c7c2306d..1db49f247a 100644 --- a/test/classes/Plugins/Export/ExportExcelTest.php +++ b/test/classes/Plugins/Export/ExportExcelTest.php @@ -179,7 +179,7 @@ class ExportExcelTest extends PmaTestCase [ 'win' => 'Windows', 'mac_excel2003' => 'Excel 2003 / Macintosh', - 'mac_excel2008' => 'Excel 2008 / Macintosh' + 'mac_excel2008' => 'Excel 2008 / Macintosh', ], $property->getValues() ); diff --git a/test/classes/Plugins/Export/ExportHtmlwordTest.php b/test/classes/Plugins/Export/ExportHtmlwordTest.php index 4a73f932df..bd712acfe4 100644 --- a/test/classes/Plugins/Export/ExportHtmlwordTest.php +++ b/test/classes/Plugins/Export/ExportHtmlwordTest.php @@ -144,7 +144,7 @@ class ExportHtmlwordTest extends PmaTestCase [ 'structure' => __('structure'), 'data' => __('data'), - 'structure_and_data' => __('structure and data') + 'structure_and_data' => __('structure and data'), ], $property->getValues() ); @@ -417,12 +417,12 @@ class ExportHtmlwordTest extends PmaTestCase $keys = [ [ 'Non_unique' => 0, - 'Column_name' => 'name1' + 'Column_name' => 'name1', ], [ 'Non_unique' => 1, - 'Column_name' => 'name2' - ] + 'Column_name' => 'name2', + ], ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -471,12 +471,12 @@ class ExportHtmlwordTest extends PmaTestCase $keys = [ [ 'Non_unique' => 0, - 'Column_name' => 'name1' + 'Column_name' => 'name1', ], [ 'Non_unique' => 1, - 'Column_name' => 'name2' - ] + 'Column_name' => 'name2', + ], ]; // case 1 @@ -494,7 +494,7 @@ class ExportHtmlwordTest extends PmaTestCase 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); @@ -504,7 +504,7 @@ class ExportHtmlwordTest extends PmaTestCase ->will($this->returnValue($keys)); $columns = [ - 'Field' => 'fieldname' + 'Field' => 'fieldname', ]; $dbi->expects($this->once()) ->method('getColumns') @@ -524,7 +524,7 @@ class ExportHtmlwordTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['fieldname' => 'testComment'] + 'comment' => ['fieldname' => 'testComment'], ] ) ); @@ -547,7 +547,7 @@ class ExportHtmlwordTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $result = $this->object->getTableDef( @@ -582,15 +582,15 @@ class ExportHtmlwordTest extends PmaTestCase [ 'fieldname' => [ 'foreign_table' => 'ftable', - 'foreign_field' => 'ffield' - ] + 'foreign_field' => 'ffield', + ], ], [ 'field' => [ 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); @@ -600,7 +600,7 @@ class ExportHtmlwordTest extends PmaTestCase ->will($this->returnValue($keys)); $columns = [ - 'Field' => 'fieldname' + 'Field' => 'fieldname', ]; $dbi->expects($this->once()) @@ -621,7 +621,7 @@ class ExportHtmlwordTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['field' => 'testComment'] + 'comment' => ['field' => 'testComment'], ] ) ); @@ -639,7 +639,7 @@ class ExportHtmlwordTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $result = $this->object->getTableDef( @@ -672,7 +672,7 @@ class ExportHtmlwordTest extends PmaTestCase ->will($this->returnValue($keys)); $columns = [ - 'Field' => 'fieldname' + 'Field' => 'fieldname', ]; $dbi->expects($this->once()) @@ -693,7 +693,7 @@ class ExportHtmlwordTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['field' => 'testComment'] + 'comment' => ['field' => 'testComment'], ] ) ); @@ -710,7 +710,7 @@ class ExportHtmlwordTest extends PmaTestCase 'mimework' => false, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $result = $this->object->getTableDef( @@ -748,7 +748,7 @@ class ExportHtmlwordTest extends PmaTestCase 'action_timing' => 'ac>t', 'event_manipulation' => 'manip&', 'definition' => 'def' - ] + ], ]; $dbi->expects($this->once()) @@ -923,7 +923,7 @@ class ExportHtmlwordTest extends PmaTestCase 'Field' => 'fields', 'Key' => 'COMP', 'Type' => '', - 'Default' => 'def' + 'Default' => 'def', ]; $unique_keys = [ diff --git a/test/classes/Plugins/Export/ExportLatexTest.php b/test/classes/Plugins/Export/ExportLatexTest.php index b05b98bc96..da8f719557 100644 --- a/test/classes/Plugins/Export/ExportLatexTest.php +++ b/test/classes/Plugins/Export/ExportLatexTest.php @@ -181,7 +181,7 @@ class ExportLatexTest extends PmaTestCase [ 'structure' => __('structure'), 'data' => __('data'), - 'structure_and_data' => __('structure and data') + 'structure_and_data' => __('structure and data'), ], $property->getValues() ); @@ -673,12 +673,12 @@ class ExportLatexTest extends PmaTestCase $keys = [ [ 'Non_unique' => 0, - 'Column_name' => 'name1' + 'Column_name' => 'name1', ], [ 'Non_unique' => 1, - 'Column_name' => 'name2' - ] + 'Column_name' => 'name2', + ], ]; // case 1 @@ -701,7 +701,7 @@ class ExportLatexTest extends PmaTestCase 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'testmimetype_' - ] + ], ] ); @@ -717,8 +717,8 @@ class ExportLatexTest extends PmaTestCase 'Field' => 'fields', 'Key' => 'COMP', 'Type' => '', - 'Default' => 'def' - ] + 'Default' => 'def', + ], ]; $dbi->expects($this->once()) ->method('getColumns') @@ -738,7 +738,7 @@ class ExportLatexTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['name1' => 'testComment'] + 'comment' => ['name1' => 'testComment'], ] ) ); @@ -757,7 +757,7 @@ class ExportLatexTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; ob_start(); @@ -812,16 +812,16 @@ class ExportLatexTest extends PmaTestCase [ 'name1' => [ 'foreign_table' => 'ftable', - 'foreign_field' => 'ffield' + 'foreign_field' => 'ffield', ], - 'foreign_keys_data' => [] + 'foreign_keys_data' => [], ], [ 'field' => [ 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); @@ -848,7 +848,7 @@ class ExportLatexTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['field' => 'testComment'] + 'comment' => ['field' => 'testComment'], ] ) ); @@ -864,7 +864,7 @@ class ExportLatexTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; ob_start(); @@ -918,7 +918,7 @@ class ExportLatexTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['field' => 'testComment'] + 'comment' => ['field' => 'testComment'], ] ) ); @@ -940,7 +940,7 @@ class ExportLatexTest extends PmaTestCase 'mimework' => false, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; ob_start(); diff --git a/test/classes/Plugins/Export/ExportMediawikiTest.php b/test/classes/Plugins/Export/ExportMediawikiTest.php index f4c7868a06..bd36caa9fe 100644 --- a/test/classes/Plugins/Export/ExportMediawikiTest.php +++ b/test/classes/Plugins/Export/ExportMediawikiTest.php @@ -156,7 +156,7 @@ class ExportMediawikiTest extends PmaTestCase [ 'structure' => __('structure'), 'data' => __('data'), - 'structure_and_data' => __('structure and data') + 'structure_and_data' => __('structure and data'), ], $sgHeader->getValues() ); @@ -283,7 +283,7 @@ class ExportMediawikiTest extends PmaTestCase 'Type' => '', 'Default' => 'def', 'Extra' => 'ext' - ] + ], ]; $dbi->expects($this->at(0)) diff --git a/test/classes/Plugins/Export/ExportOdsTest.php b/test/classes/Plugins/Export/ExportOdsTest.php index fbaa2735dd..c2a5560ea7 100644 --- a/test/classes/Plugins/Export/ExportOdsTest.php +++ b/test/classes/Plugins/Export/ExportOdsTest.php @@ -346,8 +346,14 @@ class ExportOdsTest extends PmaTestCase ->will( $this->returnValue( [ - null, '01-01-2000', '01-01-2000', '01-01-2000 10:00:00', - "01-01-2014 10:02:00", "t>s", "a&b", "<" + null, + '01-01-2000', + '01-01-2000', + '01-01-2000 10:00:00', + "01-01-2014 10:02:00", + "t>s", + "a&b", + "<", ] ) ); diff --git a/test/classes/Plugins/Export/ExportOdtTest.php b/test/classes/Plugins/Export/ExportOdtTest.php index 76aede239c..5e6089099b 100644 --- a/test/classes/Plugins/Export/ExportOdtTest.php +++ b/test/classes/Plugins/Export/ExportOdtTest.php @@ -154,7 +154,7 @@ class ExportOdtTest extends PmaTestCase [ 'structure' => __('structure'), 'data' => __('data'), - 'structure_and_data' => __('structure and data') + 'structure_and_data' => __('structure and data'), ], $property->getValues() ); @@ -464,7 +464,10 @@ class ExportOdtTest extends PmaTestCase ->will( $this->returnValue( [ - null, 'a<b', 'a>b', 'a&b' + null, + 'a<b', + 'a>b', + 'a&b', ] ) ); @@ -712,12 +715,12 @@ class ExportOdtTest extends PmaTestCase 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); $columns = [ - 'Field' => 'fieldname' + 'Field' => 'fieldname', ]; $dbi->expects($this->once()) ->method('getColumns') @@ -737,7 +740,7 @@ class ExportOdtTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['fieldname' => 'testComment'] + 'comment' => ['fieldname' => 'testComment'], ] ) ); @@ -758,7 +761,7 @@ class ExportOdtTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $this->assertTrue( $this->object->getTableDef( @@ -810,20 +813,20 @@ class ExportOdtTest extends PmaTestCase [ 'fieldname' => [ 'foreign_table' => 'ftable', - 'foreign_field' => 'ffield' - ] + 'foreign_field' => 'ffield', + ], ], [ 'field' => [ 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); $columns = [ - 'Field' => 'fieldname' + 'Field' => 'fieldname', ]; $dbi->expects($this->once()) @@ -844,7 +847,7 @@ class ExportOdtTest extends PmaTestCase ->will( $this->returnValue( [ - 'comment' => ['field' => 'testComment'] + 'comment' => ['field' => 'testComment'], ] ) ); @@ -860,7 +863,7 @@ class ExportOdtTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $this->assertTrue( @@ -898,7 +901,7 @@ class ExportOdtTest extends PmaTestCase 'action_timing' => 'ac>t', 'event_manipulation' => 'manip&', 'definition' => 'def' - ] + ], ]; $dbi->expects($this->once()) @@ -1111,7 +1114,7 @@ class ExportOdtTest extends PmaTestCase 'Field' => 'fields', 'Key' => 'COMP', 'Type' => '', - 'Default' => 'def' + 'Default' => 'def', ]; $this->assertEquals( diff --git a/test/classes/Plugins/Export/ExportPdfTest.php b/test/classes/Plugins/Export/ExportPdfTest.php index 1fc00ff9df..78420ab7fd 100644 --- a/test/classes/Plugins/Export/ExportPdfTest.php +++ b/test/classes/Plugins/Export/ExportPdfTest.php @@ -170,7 +170,7 @@ class ExportPdfTest extends PmaTestCase [ 'structure' => __('structure'), 'data' => __('data'), - 'structure_and_data' => __('structure and data') + 'structure_and_data' => __('structure and data'), ], $property->getValues() ); @@ -279,8 +279,10 @@ class ExportPdfTest extends PmaTestCase ->method('setAttributes') ->with( [ - 'currentDb' => 'db', 'currentTable' => 'table', - 'dbAlias' => 'db', 'tableAlias' => 'table', + 'currentDb' => 'db', + 'currentTable' => 'table', + 'dbAlias' => 'db', + 'tableAlias' => 'table', 'aliases' => [], 'purpose' => __('Dumping data') ] diff --git a/test/classes/Plugins/Export/ExportSqlTest.php b/test/classes/Plugins/Export/ExportSqlTest.php index 884c8b5f1e..13ce5445f4 100644 --- a/test/classes/Plugins/Export/ExportSqlTest.php +++ b/test/classes/Plugins/Export/ExportSqlTest.php @@ -203,7 +203,7 @@ class ExportSqlTest extends PmaTestCase $this->assertEquals( [ 'v1' => 'v1', - 'v2' => 'v2' + 'v2' => 'v2', ], $property->getValues() ); @@ -724,8 +724,20 @@ class ExportSqlTest extends PmaTestCase ->will( $this->returnValueMap( [ - ['db', 'EVENT', 'f1', DatabaseInterface::CONNECT_USER, 'f1event'], - ['db', 'EVENT', 'f2', DatabaseInterface::CONNECT_USER, 'f2event'] + [ + 'db', + 'EVENT', + 'f1', + DatabaseInterface::CONNECT_USER, + 'f1event', + ], + [ + 'db', + 'EVENT', + 'f2', + DatabaseInterface::CONNECT_USER, + 'f2event', + ], ] ) ); @@ -862,7 +874,7 @@ class ExportSqlTest extends PmaTestCase 'Default' => 'a', 'Comment' => 'cmt', 'Field' => 'fname' - ] + ], ] ) ); @@ -907,7 +919,7 @@ class ExportSqlTest extends PmaTestCase 'Null' => 'YES', 'Comment' => 'cmt', 'Field' => 'fname' - ] + ], ] ) ); @@ -1015,7 +1027,7 @@ class ExportSqlTest extends PmaTestCase "CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,\n" . "CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE SET NULL ON UPDATE CASCADE,\n" . "CONSTRAINT `fk_payment_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE\n" . - ") ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8\n" + ") ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8\n", ]; $dbi->expects($this->exactly(1)) @@ -1023,7 +1035,10 @@ class ExportSqlTest extends PmaTestCase ->will( $this->returnValueMap( [ - ['res', $row] + [ + 'res', + $row, + ], ] ) ); @@ -1224,7 +1239,7 @@ class ExportSqlTest extends PmaTestCase 'mimework' => true, 'db' => 'database', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $GLOBALS['sql_include_comments'] = true; $GLOBALS['crlf'] = "\n"; @@ -1242,15 +1257,15 @@ class ExportSqlTest extends PmaTestCase [ 'foo' => [ 'foreign_table' => 'ftable', - 'foreign_field' => 'ffield' - ] + 'foreign_field' => 'ffield', + ], ], [ 'fieldname' => [ 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); @@ -1304,7 +1319,10 @@ class ExportSqlTest extends PmaTestCase ->will( $this->returnValue( [ - ['create' => 'bar', 'drop' => 'foo'] + [ + 'create' => 'bar', + 'drop' => 'foo' + ], ] ) ); @@ -1564,7 +1582,13 @@ class ExportSqlTest extends PmaTestCase $dbi->expects($this->exactly(2)) ->method('fetchRow') ->willReturnOnConsecutiveCalls( - [null, 'test', '10', '6', "\x00\x0a\x0d\x1a"], + [ + null, + 'test', + '10', + '6', + "\x00\x0a\x0d\x1a", + ], null ); $dbi->expects($this->any())->method('escapeString') @@ -1697,7 +1721,10 @@ class ExportSqlTest extends PmaTestCase $dbi->expects($this->exactly(2)) ->method('fetchRow') ->willReturnOnConsecutiveCalls( - [null, null], + [ + null, + null, + ], null ); @@ -1922,13 +1949,13 @@ class ExportSqlTest extends PmaTestCase 'alias' => 'aliastest', 'tables' => [ 'foo' => [ - 'alias' => 'qwerty' + 'alias' => 'qwerty', ], 'bar' => [ - 'alias' => 'f' - ] - ] - ] + 'alias' => 'f', + ], + ], + ], ]; $db = 'a'; $table = null; @@ -1967,17 +1994,17 @@ class ExportSqlTest extends PmaTestCase 'alias' => 'qwerty', 'columns' => [ 'baz' => 'p', - 'pqr' => 'pphymdain' - ] + 'pqr' => 'pphymdain', + ], ], 'bar' => [ 'alias' => 'f', 'columns' => [ - 'xy' => 'n' - ] - ] - ] - ] + 'xy' => 'n', + ], + ], + ], + ], ]; $this->assertEquals( @@ -2016,17 +2043,17 @@ class ExportSqlTest extends PmaTestCase 'alias' => 'bartest', 'columns' => [ 'baz' => 'p', - 'pqr' => 'pphymdain' - ] + 'pqr' => 'pphymdain', + ], ], 'bar' => [ 'alias' => 'f', 'columns' => [ - 'xy' => 'n' - ] - ] - ] - ] + 'xy' => 'n', + ], + ], + ], + ], ]; $db = 'a'; diff --git a/test/classes/Plugins/Export/ExportTexytextTest.php b/test/classes/Plugins/Export/ExportTexytextTest.php index fe5438244c..8c4a17516c 100644 --- a/test/classes/Plugins/Export/ExportTexytextTest.php +++ b/test/classes/Plugins/Export/ExportTexytextTest.php @@ -317,12 +317,12 @@ class ExportTexytextTest extends PmaTestCase $keys = [ [ 'Non_unique' => 0, - 'Column_name' => 'cname' + 'Column_name' => 'cname', ], [ 'Non_unique' => 1, - 'Column_name' => 'cname2' - ] + 'Column_name' => 'cname2', + ], ]; $dbi->expects($this->once()) @@ -379,12 +379,12 @@ class ExportTexytextTest extends PmaTestCase $keys = [ [ 'Non_unique' => 0, - 'Column_name' => 'cname' + 'Column_name' => 'cname', ], [ 'Non_unique' => 1, - 'Column_name' => 'cname2' - ] + 'Column_name' => 'cname2', + ], ]; $dbi->expects($this->once()) @@ -398,15 +398,15 @@ class ExportTexytextTest extends PmaTestCase [ 'fname' => [ 'foreign_table' => '<ftable', - 'foreign_field' => 'ffield>' - ] + 'foreign_field' => 'ffield>', + ], ], [ 'fname' => [ 'values' => 'test-', 'transformation' => 'testfoo', 'mimetype' => 'test<' - ] + ], ] ); @@ -420,7 +420,7 @@ class ExportTexytextTest extends PmaTestCase $columns = [ 'Field' => 'fname', - 'Comment' => 'comm' + 'Comment' => 'comm', ]; $dbi->expects($this->exactly(2)) @@ -444,7 +444,7 @@ class ExportTexytextTest extends PmaTestCase 'mimework' => true, 'db' => 'db', 'relation' => 'rel', - 'column_info' => 'col' + 'column_info' => 'col', ]; $result = $this->object->getTableDef( @@ -480,7 +480,7 @@ class ExportTexytextTest extends PmaTestCase 'action_timing' => 'ac>t', 'event_manipulation' => 'manip&', 'definition' => 'def' - ] + ], ]; $dbi->expects($this->once()) @@ -662,7 +662,7 @@ class ExportTexytextTest extends PmaTestCase 'Field' => 'fields', 'Key' => 'COMP', 'Type' => '', - 'Default' => 'def' + 'Default' => 'def', ]; $unique_keys = [ diff --git a/test/classes/Plugins/Export/ExportXmlTest.php b/test/classes/Plugins/Export/ExportXmlTest.php index 062defc575..7e640e5003 100644 --- a/test/classes/Plugins/Export/ExportXmlTest.php +++ b/test/classes/Plugins/Export/ExportXmlTest.php @@ -226,7 +226,10 @@ class ExportXmlTest extends PmaTestCase 'DEFAULT_CHARACTER_SET_NAME' => 'utf-8', ], - 'table' => [null, '"tbl"'] + 'table' => [ + null, + '"tbl"', + ], ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() @@ -249,7 +252,7 @@ class ExportXmlTest extends PmaTestCase [ 'create' => 'crt', 'name' => 'trname' - ] + ], ] ) ); @@ -334,14 +337,20 @@ class ExportXmlTest extends PmaTestCase 'DEFAULT_COLLATION_NAME' => 'utf8_general_ci', 'DEFAULT_CHARACTER_SET_NAME' => 'utf-8', - ] + ], ]; $result_2 = [ - 't1' => [null, '"tbl"'] + 't1' => [ + null, + '"tbl"', + ], ]; $result_3 = [ - 't2' => [null, '"tbl"'] + 't2' => [ + null, + '"tbl"', + ], ]; $dbi->expects($this->exactly(5)) @@ -360,7 +369,10 @@ class ExportXmlTest extends PmaTestCase $GLOBALS['dbi'] = $dbi; - $GLOBALS['tables'] = ['t1', 't2']; + $GLOBALS['tables'] = [ + 't1', + 't2', + ]; ob_start(); $this->assertTrue( diff --git a/test/classes/Plugins/Export/ExportYamlTest.php b/test/classes/Plugins/Export/ExportYamlTest.php index c31dc02a98..9b7d767618 100644 --- a/test/classes/Plugins/Export/ExportYamlTest.php +++ b/test/classes/Plugins/Export/ExportYamlTest.php @@ -235,7 +235,11 @@ class ExportYamlTest extends PmaTestCase ->with(true) ->will( $this->returnValue( - [null, '123', "\"c\\a\nb\r"] + [ + null, + '123', + "\"c\\a\nb\r", + ] ) ); diff --git a/test/classes/Plugins/Export/Helpers/TablePropertyTest.php b/test/classes/Plugins/Export/Helpers/TablePropertyTest.php index 6f032a0679..a4c2b905a6 100644 --- a/test/classes/Plugins/Export/Helpers/TablePropertyTest.php +++ b/test/classes/Plugins/Export/Helpers/TablePropertyTest.php @@ -29,7 +29,14 @@ class TablePropertyTest extends PmaTestCase protected function setUp() { $GLOBALS['server'] = 0; - $row = [' name ', 'int ', true, ' PRI', '0', 'mysql']; + $row = [ + ' name ', + 'int ', + true, + ' PRI', + '0', + 'mysql', + ]; $this->object = new TableProperty($row); } @@ -130,9 +137,18 @@ class TablePropertyTest extends PmaTestCase public function isNotNullProvider() { return [ - ["NO", "true"], - ["", "false"], - ["no", "false"] + [ + "NO", + "true", + ], + [ + "", + "false", + ], + [ + "no", + "false", + ], ]; } @@ -163,11 +179,26 @@ class TablePropertyTest extends PmaTestCase public function isUniqueProvider() { return [ - ["PRI", "true"], - ["UNI", "true"], - ["", "false"], - ["pri", "false"], - ["uni", "false"], + [ + "PRI", + "true", + ], + [ + "UNI", + "true", + ], + [ + "", + "false", + ], + [ + "pri", + "false", + ], + [ + "uni", + "false", + ], ]; } @@ -198,17 +229,50 @@ class TablePropertyTest extends PmaTestCase public function getDotNetPrimitiveTypeProvider() { return [ - ["int", "int"], - ["long", "long"], - ["char", "string"], - ["varchar", "string"], - ["text", "string"], - ["longtext", "string"], - ["tinyint", "bool"], - ["datetime", "DateTime"], - ["", "unknown"], - ["dummy", "unknown"], - ["INT", "unknown"] + [ + "int", + "int", + ], + [ + "long", + "long", + ], + [ + "char", + "string", + ], + [ + "varchar", + "string", + ], + [ + "text", + "string", + ], + [ + "longtext", + "string", + ], + [ + "tinyint", + "bool", + ], + [ + "datetime", + "DateTime", + ], + [ + "", + "unknown", + ], + [ + "dummy", + "unknown", + ], + [ + "INT", + "unknown", + ], ]; } @@ -239,17 +303,50 @@ class TablePropertyTest extends PmaTestCase public function getDotNetObjectTypeProvider() { return [ - ["int", "Int32"], - ["long", "Long"], - ["char", "String"], - ["varchar", "String"], - ["text", "String"], - ["longtext", "String"], - ["tinyint", "Boolean"], - ["datetime", "DateTime"], - ["", "Unknown"], - ["dummy", "Unknown"], - ["INT", "Unknown"] + [ + "int", + "Int32", + ], + [ + "long", + "Long", + ], + [ + "char", + "String", + ], + [ + "varchar", + "String", + ], + [ + "text", + "String", + ], + [ + "longtext", + "String", + ], + [ + "tinyint", + "Boolean", + ], + [ + "datetime", + "DateTime", + ], + [ + "", + "Unknown", + ], + [ + "dummy", + "Unknown", + ], + [ + "INT", + "Unknown", + ], ]; } diff --git a/test/classes/Plugins/Schema/DiaRelationSchemaTest.php b/test/classes/Plugins/Schema/DiaRelationSchemaTest.php index 18e25f3847..4c2788b85d 100644 --- a/test/classes/Plugins/Schema/DiaRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/DiaRelationSchemaTest.php @@ -77,12 +77,12 @@ class DiaRelationSchemaTest extends PmaTestCase $fetchArrayReturn = [ //table name in information_schema_relations - 'table_name' => 'CHARACTER_SETS' + 'table_name' => 'CHARACTER_SETS', ]; $fetchArrayReturn2 = [ //table name in information_schema_relations - 'table_name' => 'COLLATIONS' + 'table_name' => 'COLLATIONS', ]; $dbi->expects($this->at(2)) @@ -101,8 +101,8 @@ class DiaRelationSchemaTest extends PmaTestCase 'Field' => 'field1', 'Key' => 'PRIMARY', 'Key_name' => "Key_name", - 'Column_name' => "Column_name" - ] + 'Column_name' => "Column_name", + ], ]; $dbi->expects($this->any())->method('getTableIndexes') ->will($this->returnValue($getIndexesResult)); diff --git a/test/classes/Plugins/Schema/EpsRelationSchemaTest.php b/test/classes/Plugins/Schema/EpsRelationSchemaTest.php index c430d272c0..43f0e2cf03 100644 --- a/test/classes/Plugins/Schema/EpsRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/EpsRelationSchemaTest.php @@ -78,12 +78,12 @@ class EpsRelationSchemaTest extends PmaTestCase $fetchArrayReturn = [ //table name in information_schema_relations - 'table_name' => 'CHARACTER_SETS' + 'table_name' => 'CHARACTER_SETS', ]; $fetchArrayReturn2 = [ //table name in information_schema_relations - 'table_name' => 'COLLATIONS' + 'table_name' => 'COLLATIONS', ]; $dbi->expects($this->at(2)) @@ -102,8 +102,8 @@ class EpsRelationSchemaTest extends PmaTestCase 'Field' => 'field1', 'Key' => 'PRIMARY', 'Key_name' => "Key_name", - 'Column_name' => "Column_name" - ] + 'Column_name' => "Column_name", + ], ]; $dbi->expects($this->any())->method('getTableIndexes') ->will($this->returnValue($getIndexesResult)); diff --git a/test/classes/Plugins/Schema/PdfRelationSchemaTest.php b/test/classes/Plugins/Schema/PdfRelationSchemaTest.php index be1b267277..d0e1978c6b 100644 --- a/test/classes/Plugins/Schema/PdfRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/PdfRelationSchemaTest.php @@ -90,12 +90,12 @@ class PdfRelationSchemaTest extends PmaTestCase $fetchArrayReturn = [ //table name in information_schema_relations - 'table_name' => 'CHARACTER_SETS' + 'table_name' => 'CHARACTER_SETS', ]; $fetchArrayReturn2 = [ //table name in information_schema_relations - 'table_name' => 'COLLATIONS' + 'table_name' => 'COLLATIONS', ]; $dbi->expects($this->at(2)) @@ -110,7 +110,7 @@ class PdfRelationSchemaTest extends PmaTestCase $fetchRowReturn = [ 'table_name', - 'table_name' + 'table_name', ]; //let fetchRow have more results @@ -126,7 +126,7 @@ class PdfRelationSchemaTest extends PmaTestCase "Type" => "char(60)", "Null" => "NO", 'Extra' => "Extra", - ] + ], ]; $dbi->expects($this->any())->method('getColumns') ->will($this->returnValue($fields_info)); @@ -140,8 +140,8 @@ class PdfRelationSchemaTest extends PmaTestCase 'Field' => 'field1', 'Key' => 'PRIMARY', 'Key_name' => "Key_name", - 'Column_name' => "Column_name" - ] + 'Column_name' => "Column_name", + ], ]; $dbi->expects($this->any())->method('getTableIndexes') ->will($this->returnValue($getIndexesResult)); @@ -161,8 +161,14 @@ class PdfRelationSchemaTest extends PmaTestCase ->will($this->returnValue($fetchValue)); $fetchResult = [ - 'column1' => ['mimetype' => 'value1', 'transformation' => 'pdf'], - 'column2' => ['mimetype' => 'value2', 'transformation' => 'xml'], + 'column1' => [ + 'mimetype' => 'value1', + 'transformation' => 'pdf', + ], + 'column2' => [ + 'mimetype' => 'value2', + 'transformation' => 'xml', + ], ]; $dbi->expects($this->any())->method('fetchResult') diff --git a/test/classes/Plugins/Schema/SvgRelationSchemaTest.php b/test/classes/Plugins/Schema/SvgRelationSchemaTest.php index 7f2f2f5846..1fbc883bbf 100644 --- a/test/classes/Plugins/Schema/SvgRelationSchemaTest.php +++ b/test/classes/Plugins/Schema/SvgRelationSchemaTest.php @@ -77,12 +77,12 @@ class SvgRelationSchemaTest extends PmaTestCase $fetchArrayReturn = [ //table name in information_schema_relations - 'table_name' => 'CHARACTER_SETS' + 'table_name' => 'CHARACTER_SETS', ]; $fetchArrayReturn2 = [ //table name in information_schema_relations - 'table_name' => 'COLLATIONS' + 'table_name' => 'COLLATIONS', ]; $dbi->expects($this->at(2)) @@ -101,8 +101,8 @@ class SvgRelationSchemaTest extends PmaTestCase 'Field' => 'field1', 'Key' => 'PRIMARY', 'Key_name' => "Key_name", - 'Column_name' => "Column_name" - ] + 'Column_name' => "Column_name", + ], ]; $dbi->expects($this->any())->method('getTableIndexes') ->will($this->returnValue($getIndexesResult)); diff --git a/test/classes/Plugins/Transformations/TransformationPluginsTest.php b/test/classes/Plugins/Transformations/TransformationPluginsTest.php index 175e88be8f..065d185bf1 100644 --- a/test/classes/Plugins/Transformations/TransformationPluginsTest.php +++ b/test/classes/Plugins/Transformations/TransformationPluginsTest.php @@ -48,7 +48,10 @@ class TransformationPluginsTest extends PmaTestCase // For Application Octetstream Download plugin global $row, $fields_meta; $fields_meta = []; - $row = ["pma" => "aaa", "pca" => "bbb"]; + $row = [ + "pma" => "aaa", + "pca" => "bbb", + ]; // For Image_*_Inline plugin $GLOBALS['PMA_Config'] = new Config(); @@ -81,29 +84,29 @@ class TransformationPluginsTest extends PmaTestCase [ new Image_JPEG_Upload(), 'getName', - 'Image upload' + 'Image upload', ], [ new Image_JPEG_Upload(), 'getInfo', 'Image upload functionality which also displays a thumbnail.' . ' The options are the width and height of the thumbnail' - . ' in pixels. Defaults to 100 X 100.' + . ' in pixels. Defaults to 100 X 100.', ], [ new Image_JPEG_Upload(), 'getMIMEType', - 'Image' + 'Image', ], [ new Image_JPEG_Upload(), 'getMIMESubtype', - 'JPEG' + 'JPEG', ], [ new Image_JPEG_Upload(), 'getScripts', - ['transformations/image_upload.js'] + ['transformations/image_upload.js'], ], [ new Image_JPEG_Upload(), @@ -120,8 +123,8 @@ class TransformationPluginsTest extends PmaTestCase 'ltr', 0, 0, - 0 - ] + 0, + ], ], [ new Image_JPEG_Upload(), @@ -138,41 +141,41 @@ class TransformationPluginsTest extends PmaTestCase 0, '2ndtest', [ - 'wrapper_link' => '?table=a' + 'wrapper_link' => '?table=a', ], 'something', 'ltr', 0, 0, - 0 - ] + 0, + ], ], // Test data for TextPlainFileupload plugin [ new Text_Plain_FileUpload(), 'getName', - 'Text file upload' + 'Text file upload', ], [ new Text_Plain_FileUpload(), 'getInfo', 'File upload functionality for TEXT columns. ' - . 'It does not have a textarea for input.' + . 'It does not have a textarea for input.', ], [ new Text_Plain_FileUpload(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_FileUpload(), 'getMIMESubtype', - 'Plain' + 'Plain', ], [ new Text_Plain_FileUpload(), 'getScripts', - [] + [], ], [ new Text_Plain_FileUpload(), @@ -187,8 +190,8 @@ class TransformationPluginsTest extends PmaTestCase 'ltr', 0, 0, - 0 - ] + 0, + ], ], [ new Text_Plain_FileUpload(), @@ -206,45 +209,53 @@ class TransformationPluginsTest extends PmaTestCase 'ltr', 0, 0, - 0 - ] + 0, + ], ], // Test data for Text_Plain_Regexvalidation plugin [ new Text_Plain_RegexValidation(), 'getName', - 'Regex Validation' + 'Regex Validation', ], [ new Text_Plain_RegexValidation(), 'getInfo', 'Validates the string using regular expression ' . 'and performs insert only if string matches it. ' - . 'The first option is the Regular Expression.' + . 'The first option is the Regular Expression.', ], [ new Text_Plain_RegexValidation(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_RegexValidation(), 'getMIMESubtype', - 'Plain' + 'Plain', ], [ new Text_Plain_RegexValidation(), 'getInputHtml', '', [ - [], 0, '', [], '', 'ltr', 0, 0, 0 - ] + [], + 0, + '', + [], + '', + 'ltr', + 0, + 0, + 0, + ], ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Application_Octetstream_Download plugin [ new Application_Octetstream_Download(), 'getName', - 'Download' + 'Download', ], [ new Application_Octetstream_Download(), @@ -253,116 +264,116 @@ class TransformationPluginsTest extends PmaTestCase . ' use the first option to specify the filename, or use the second' . ' option as the name of a column which contains the filename. If' . ' you use the second option, you need to set the first option to' - . ' the empty string.' + . ' the empty string.', ], [ new Application_Octetstream_Download(), 'getMIMEType', - 'Application' + 'Application', ], [ new Application_Octetstream_Download(), 'getMIMESubtype', - 'OctetStream' + 'OctetStream', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Application_Octetstream_Hex plugin [ new Application_Octetstream_Hex(), 'getName', - 'Hex' + 'Hex', ], [ new Application_Octetstream_Hex(), 'getInfo', 'Displays hexadecimal representation of data. Optional first' . ' parameter specifies how often space will be added (defaults' - . ' to 2 nibbles).' + . ' to 2 nibbles).', ], [ new Application_Octetstream_Hex(), 'getMIMEType', - 'Application' + 'Application', ], [ new Application_Octetstream_Hex(), 'getMIMESubtype', - 'OctetStream' + 'OctetStream', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Image_JPEG_Inline plugin [ new Image_JPEG_Inline(), 'getName', - 'Inline' + 'Inline', ], [ new Image_JPEG_Inline(), 'getInfo', 'Displays a clickable thumbnail. The options are the maximum width' - . ' and height in pixels. The original aspect ratio is preserved.' + . ' and height in pixels. The original aspect ratio is preserved.', ], [ new Image_JPEG_Inline(), 'getMIMEType', - 'Image' + 'Image', ], [ new Image_JPEG_Inline(), 'getMIMESubtype', - 'JPEG' + 'JPEG', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Image_JPEG_Link plugin [ new Image_JPEG_Link(), 'getName', - 'ImageLink' + 'ImageLink', ], [ new Image_JPEG_Link(), 'getInfo', - 'Displays a link to download this image.' + 'Displays a link to download this image.', ], [ new Image_JPEG_Link(), 'getMIMEType', - 'Image' + 'Image', ], [ new Image_JPEG_Link(), 'getMIMESubtype', - 'JPEG' + 'JPEG', ], [ new Image_JPEG_Link(), 'applyTransformationNoWrap', - null + null, ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Image_PNG_Inline plugin [ new Image_PNG_Inline(), 'getName', - 'Inline' + 'Inline', ], [ new Image_PNG_Inline(), 'getInfo', 'Displays a clickable thumbnail. The options are the maximum width' - . ' and height in pixels. The original aspect ratio is preserved.' + . ' and height in pixels. The original aspect ratio is preserved.', ], [ new Image_PNG_Inline(), 'getMIMEType', - 'Image' + 'Image', ], [ new Image_PNG_Inline(), 'getMIMESubtype', - 'PNG' + 'PNG', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Dateformat plugin [ new Text_Plain_Dateformat(), 'getName', - 'Date Format' + 'Date Format', ], [ new Text_Plain_Dateformat(), @@ -375,23 +386,23 @@ class TransformationPluginsTest extends PmaTestCase . ' UTC one (use "local" or "utc" strings) for that. According to' . ' that, date format has different value - for "local" see the' . ' documentation for PHP\'s strftime() function and for "utc" it' - . ' is done using gmdate() function.' + . ' is done using gmdate() function.', ], [ new Text_Plain_Dateformat(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Dateformat(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_External plugin [ new Text_Plain_External(), 'getName', - 'External' + 'External', ], [ new Text_Plain_External(), @@ -408,25 +419,28 @@ class TransformationPluginsTest extends PmaTestCase . ' The third option, if set to 1, will convert the output using' . ' htmlspecialchars() (Default 1). The fourth option, if set to 1,' . ' will prevent wrapping and ensure that the output appears all on' - . ' one line (Default 1).' + . ' one line (Default 1).', ], [ new Text_Plain_External(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_External(), 'getMIMESubtype', - 'Plain' + 'Plain', ], [ new Text_Plain_External(), 'applyTransformationNoWrap', true, [ - ["/dev/null -i -wrap -q", "/dev/null -i -wrap -q"] - ] + [ + "/dev/null -i -wrap -q", + "/dev/null -i -wrap -q", + ], + ], ], [ new Text_Plain_External(), @@ -436,9 +450,10 @@ class TransformationPluginsTest extends PmaTestCase [ "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", - "/dev/null -i -wrap -q", 1 - ] - ] + "/dev/null -i -wrap -q", + 1, + ], + ], ], [ new Text_Plain_External(), @@ -448,9 +463,10 @@ class TransformationPluginsTest extends PmaTestCase [ "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", - "/dev/null -i -wrap -q", "1" - ] - ] + "/dev/null -i -wrap -q", + "1", + ], + ], ], [ new Text_Plain_External(), @@ -461,38 +477,38 @@ class TransformationPluginsTest extends PmaTestCase "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", "/dev/null -i -wrap -q", - 2 - ] - ] + 2, + ], + ], ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Formatted plugin [ new Text_Plain_Formatted(), 'getName', - 'Formatted' + 'Formatted', ], [ new Text_Plain_Formatted(), 'getInfo', 'Displays the contents of the column as-is, without running it' . ' through htmlspecialchars(). That is, the column is assumed' - . ' to contain valid HTML.' + . ' to contain valid HTML.', ], [ new Text_Plain_Formatted(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Formatted(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Imagelink plugin [ new Text_Plain_Imagelink(), 'getName', - 'Image Link' + 'Image Link', ], [ new Text_Plain_Imagelink(), @@ -501,112 +517,112 @@ class TransformationPluginsTest extends PmaTestCase . 'the column contains the filename. The first option' . ' is a URL prefix like "https://www.example.com/". ' . 'The second and third options' - . ' are the width and the height in pixels.' + . ' are the width and the height in pixels.', ], [ new Text_Plain_Imagelink(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Imagelink(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for PhpMyAdmin\Plugins\Transformations\Output\Text_Plain_Sql plugin [ new Text_Plain_Sql(), 'getName', - 'SQL' + 'SQL', ], [ new Text_Plain_Sql(), 'getInfo', - 'Formats text as SQL query with syntax highlighting.' + 'Formats text as SQL query with syntax highlighting.', ], [ new Text_Plain_Sql(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Sql(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for PhpMyAdmin\Plugins\Transformations\Text_Plain_Link plugin [ new Text_Plain_Link(), 'getName', - 'TextLink' + 'TextLink', ], [ new Text_Plain_Link(), 'getInfo', 'Displays a link; the column contains the filename. The first option' . ' is a URL prefix like "https://www.example.com/".' - . ' The second option is a title for the link.' + . ' The second option is a title for the link.', ], [ new Text_Plain_Link(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Link(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for PhpMyAdmin\Plugins\Transformations\Text_Plain_Longtoipv4 plugin [ new Text_Plain_Longtoipv4(), 'getName', - 'Long To IPv4' + 'Long To IPv4', ], [ new Text_Plain_Longtoipv4(), 'getInfo', 'Converts an (IPv4) Internet network address stored as a BIGINT' - . ' into a string in Internet standard dotted format.' + . ' into a string in Internet standard dotted format.', ], [ new Text_Plain_Longtoipv4(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Longtoipv4(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for Text_Plain_PreApPend plugin [ new Text_Plain_PreApPend(), 'getName', - 'PreApPend' + 'PreApPend', ], [ new Text_Plain_PreApPend(), 'getInfo', 'Prepends and/or Appends text to a string. First option is text' . ' to be prepended, second is appended (enclosed in single' - . ' quotes, default empty string).' + . ' quotes, default empty string).', ], [ new Text_Plain_PreApPend(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_PreApPend(), 'getMIMESubtype', - 'Plain' + 'Plain', ], // Test data for PhpMyAdmin\Plugins\Transformations\Text_Plain_Substring plugin [ new Text_Plain_Substring(), 'getName', - 'Substring' + 'Substring', ], [ new Text_Plain_Substring(), @@ -616,44 +632,76 @@ class TransformationPluginsTest extends PmaTestCase . '(Default 0). The second option is the number of characters ' . 'to return (Default: until end of string). The third option is ' . 'the string to append and/or prepend when truncation occurs ' - . '(Default: "…").' + . '(Default: "…").', ], [ new Text_Plain_Substring(), 'getMIMEType', - 'Text' + 'Text', ], [ new Text_Plain_Substring(), 'getMIMESubtype', - 'Plain' + 'Plain', ], [ new Text_Plain_Substring(), 'getOptions', - ['foo', 'bar', 'baz'], + [ + 'foo', + 'bar', + 'baz', + ], [ [], - ['foo', 'bar', 'baz'] - ] + [ + 'foo', + 'bar', + 'baz', + ], + ], ], [ new Text_Plain_Substring(), 'getOptions', - ['foo', 'bar', 'baz'], [ - ['foo', 'bar', 'baz'], - ['foo', 'bar', 'baz'] - ] + 'foo', + 'bar', + 'baz', + ], + [ + [ + 'foo', + 'bar', + 'baz', + ], + [ + 'foo', + 'bar', + 'baz', + ], + ], ], [ new Text_Plain_Substring(), 'getOptions', - ['foo', 'bar', 'baz'], [ - ['foo', 'bar', 'baz'], - [1, 2, 3] - ] + 'foo', + 'bar', + 'baz', + ], + [ + [ + 'foo', + 'bar', + 'baz', + ], + [ + 1, + 2, + 3, + ], + ], ], ]; } @@ -695,91 +743,100 @@ class TransformationPluginsTest extends PmaTestCase new Image_JPEG_Upload(), [ 'test', - [150, 100] + [ + 150, + 100, + ], ], - 'test' + 'test', ], [ new Text_Plain_FileUpload(), [ 'test', - [] + [], ], - 'test' + 'test', ], [ new Text_Plain_RegexValidation(), [ 'phpMyAdmin', - ['/php/i'] + ['/php/i'], ], 'phpMyAdmin', true, - '' + '', ], [ new Text_Plain_RegexValidation(), [ 'qwerty', - ['/^a/'] + ['/^a/'], ], 'qwerty', false, - 'Validation failed for the input string qwerty.' + 'Validation failed for the input string qwerty.', ], [ new Application_Octetstream_Download(), [ 'PMA_BUFFER', - ["filename", 'wrapper_link' => 'PMA_wrapper_link'] + [ + "filename", 'wrapper_link' => 'PMA_wrapper_link' + ], ], '<a href="transformation_wrapper.phpPMA_wrapper_link' . '&ct=application/octet-stream&cn=filename" ' - . 'title="filename" class="disableAjax">filename</a>' + . 'title="filename" class="disableAjax">filename</a>', ], [ new Application_Octetstream_Download(), [ 'PMA_BUFFER', - ["", 'cloumn', 'wrapper_link' => 'PMA_wrapper_link'] + [ + "", 'cloumn', 'wrapper_link' => 'PMA_wrapper_link' + ], ], '<a href="transformation_wrapper.phpPMA_wrapper_link&' . 'ct=application/octet-stream&cn=binary_file.dat" ' - . 'title="binary_file.dat" class="disableAjax">binary_file.dat</a>' + . 'title="binary_file.dat" class="disableAjax">binary_file.dat</a>', ], [ new Application_Octetstream_Hex(), [ '11111001', - [3] + [3], ], - '313 131 313 130 303 1 ' + '313 131 313 130 303 1 ', ], [ new Application_Octetstream_Hex(), [ '11111001', - [0] + [0], ], - '3131313131303031' + '3131313131303031', ], [ new Application_Octetstream_Hex(), [ '11111001', - [] + [], ], - '31 31 31 31 31 30 30 31 ' + '31 31 31 31 31 30 30 31 ', ], [ new Image_JPEG_Link(), [ 'PMA_IMAGE_LINK', - ["./image/", "200", "wrapper_link" => "PMA_wrapper_link"] + [ + "./image/", "200", "wrapper_link" => "PMA_wrapper_link" + ], ], '<a class="disableAjax" target="_blank" rel="noopener noreferrer"' . ' href="transformation_wrapper.phpPMA_wrapper_link"' - . ' alt="[PMA_IMAGE_LINK]">[BLOB]</a>' + . ' alt="[PMA_IMAGE_LINK]">[BLOB]</a>', ], [ new Text_Plain_Dateformat(), @@ -787,11 +844,11 @@ class TransformationPluginsTest extends PmaTestCase 12345, [0], (object) [ - 'type' => 'int' - ] + 'type' => 'int', + ], ], '<dfn onclick="alert(\'12345\');" title="12345">' - . 'Jan 01, 1970 at 03:25 AM</dfn>' + . 'Jan 01, 1970 at 03:25 AM</dfn>', ], [ new Text_Plain_Dateformat(), @@ -799,11 +856,11 @@ class TransformationPluginsTest extends PmaTestCase 12345678, [0], (object) [ - 'type' => 'string' - ] + 'type' => 'string', + ], ], '<dfn onclick="alert(\'12345678\');" title="12345678">' - . 'May 23, 1970 at 09:21 PM</dfn>' + . 'May 23, 1970 at 09:21 PM</dfn>', ], [ new Text_Plain_Dateformat(), @@ -811,11 +868,11 @@ class TransformationPluginsTest extends PmaTestCase 123456789, [0], (object) [ - 'type' => null - ] + 'type' => null, + ], ], '<dfn onclick="alert(\'123456789\');" title="123456789">' - . 'Nov 29, 1973 at 09:33 PM</dfn>' + . 'Nov 29, 1973 at 09:33 PM</dfn>', ], [ new Text_Plain_Dateformat(), @@ -823,71 +880,92 @@ class TransformationPluginsTest extends PmaTestCase '20100201', [0], (object) [ - 'type' => null - ] + 'type' => null, + ], ], '<dfn onclick="alert(\'20100201\');" title="20100201">' - . 'Feb 01, 2010 at 12:00 AM</dfn>' + . 'Feb 01, 2010 at 12:00 AM</dfn>', ], [ new Text_Plain_External(), [ 'PMA_BUFFER', - ["/dev/null -i -wrap -q", "/dev/null -i -wrap -q"] + [ + "/dev/null -i -wrap -q", + "/dev/null -i -wrap -q", + ], ], - 'PMA_BUFFER' + 'PMA_BUFFER', ], [ new Text_Plain_Formatted(), [ "<a ref='https://www.example.com/'>PMA_BUFFER</a>", - ["option1", "option2"] + [ + "option1", + "option2", + ], ], - "<iframe srcdoc=\"<a ref='https://www.example.com/'>PMA_BUFFER</a>\" sandbox=\"\"></iframe>" + "<iframe srcdoc=\"<a ref='https://www.example.com/'>PMA_BUFFER</a>\" sandbox=\"\"></iframe>", ], [ new Text_Plain_Formatted(), [ "<a ref=\"https://www.example.com/\">PMA_BUFFER</a>", - ["option1", "option2"] + [ + "option1", + "option2", + ], ], - "<iframe srcdoc=\"<a ref='https://www.example.com/'>PMA_BUFFER</a>\" sandbox=\"\"></iframe>" + "<iframe srcdoc=\"<a ref='https://www.example.com/'>PMA_BUFFER</a>\" sandbox=\"\"></iframe>", ], [ new Text_Plain_Imagelink(), [ 'PMA_IMAGE', - ["http://image/", "200"] + [ + "http://image/", + "200", + ], ], '<a href="http://image/PMA_IMAGE" rel="noopener noreferrer" target="_blank">' . '<img src="http://image/PMA_IMAGE" border="0" width="200" ' - . 'height="50">PMA_IMAGE</a>' + . 'height="50">PMA_IMAGE</a>', ], [ new Text_Plain_Imagelink(), [ 'PMA_IMAGE', - ["./image/", "200"] + [ + "./image/", + "200", + ], ], - './image/PMA_IMAGE' + './image/PMA_IMAGE', ], [ new Text_Plain_Sql(), [ 'select *', - ["option1", "option2"] + [ + "option1", + "option2", + ], ], '<code class="sql"><pre>' . "\n" . 'select *' . "\n" - . '</pre></code>' + . '</pre></code>', ], [ new Text_Plain_Link(), [ 'PMA_TXT_LINK', - ["./php/", "text_name"] + [ + "./php/", + "text_name", + ], ], - './php/PMA_TXT_LINK' + './php/PMA_TXT_LINK', ], [ new Text_Plain_Link(), @@ -895,7 +973,7 @@ class TransformationPluginsTest extends PmaTestCase 'PMA_TXT_LINK', [], ], - 'PMA_TXT_LINK' + 'PMA_TXT_LINK', ], [ new Text_Plain_Link(), @@ -904,47 +982,63 @@ class TransformationPluginsTest extends PmaTestCase [], ], '<a href="https://example.com/PMA_TXT_LINK" title=""' - . ' target="_blank" rel="noopener noreferrer">https://example.com/PMA_TXT_LINK</a>' + . ' target="_blank" rel="noopener noreferrer">https://example.com/PMA_TXT_LINK</a>', ], [ new Text_Plain_Link(), [ 'PMA_TXT_LINK', - ["./php/", "text_name"] + [ + "./php/", + "text_name", + ], ], - './php/PMA_TXT_LINK' + './php/PMA_TXT_LINK', ], [ new Text_Plain_Longtoipv4(), [ 42949672, - ["option1", "option2"] + [ + "option1", + "option2", + ], ], - '2.143.92.40' + '2.143.92.40', ], [ new Text_Plain_Longtoipv4(), [ 4294967295, - ["option1", "option2"] + [ + "option1", + "option2", + ], ], - '255.255.255.255' + '255.255.255.255', ], [ new Text_Plain_PreApPend(), [ 'My', - ['php', 'Admin'] + [ + 'php', + 'Admin', + ], ], - 'phpMyAdmin' + 'phpMyAdmin', ], [ new Text_Plain_Substring(), [ 'PMA_BUFFER', - [1, 3, 'suffix'] + [ + 1, + 3, + 'suffix', + ], ], - 'suffixMA_suffix' + 'suffixMA_suffix', ], ]; @@ -953,24 +1047,28 @@ class TransformationPluginsTest extends PmaTestCase new Image_JPEG_Inline(), [ 'PMA_JPEG_Inline', - ["./image/", "200", "wrapper_link" => "PMA_wrapper_link"] + [ + "./image/", "200", "wrapper_link" => "PMA_wrapper_link" + ], ], '<a href="transformation_wrapper.phpPMA_wrapper_link" ' . 'rel="noopener noreferrer" target="_blank"><img src="transformation_wrapper.php' . 'PMA_wrapper_link&resize=jpeg&newWidth=0&' - . 'newHeight=200" alt="[PMA_JPEG_Inline]" border="0"></a>' + . 'newHeight=200" alt="[PMA_JPEG_Inline]" border="0"></a>', ]; $result[] = [ new Image_PNG_Inline(), [ 'PMA_PNG_Inline', - ["./image/", "200", "wrapper_link" => "PMA_wrapper_link"] + [ + "./image/", "200", "wrapper_link" => "PMA_wrapper_link" + ], ], '<a href="transformation_wrapper.phpPMA_wrapper_link"' . ' rel="noopener noreferrer" target="_blank"><img src="transformation_wrapper.php' . 'PMA_wrapper_link&' . 'resize=jpeg&newWidth=0&newHeight=200" ' - . 'alt="[PMA_PNG_Inline]" border="0"></a>' + . 'alt="[PMA_PNG_Inline]" border="0"></a>', ]; } return $result; diff --git a/test/classes/PmaTestCase.php b/test/classes/PmaTestCase.php index e7142a40d8..e212207fe0 100644 --- a/test/classes/PmaTestCase.php +++ b/test/classes/PmaTestCase.php @@ -55,9 +55,16 @@ class PmaTestCase extends TestCase $mockResponse = $this->getMockBuilder('PhpMyAdmin\Response') ->disableOriginalConstructor() ->setMethods([ - 'header', 'headersSent', 'disable', 'isAjax', - 'setRequestStatus', 'addJSON', 'addHTML', - 'getFooter', 'getHeader','httpResponseCode', + 'header', + 'headersSent', + 'disable', + 'isAjax', + 'setRequestStatus', + 'addJSON', + 'addHTML', + 'getFooter', + 'getHeader', + 'httpResponseCode', ]) ->getMock(); diff --git a/test/classes/Properties/Options/OptionsPropertyGroupTest.php b/test/classes/Properties/Options/OptionsPropertyGroupTest.php index 0578a9348b..c7b7f1cd65 100644 --- a/test/classes/Properties/Options/OptionsPropertyGroupTest.php +++ b/test/classes/Properties/Options/OptionsPropertyGroupTest.php @@ -60,7 +60,12 @@ class OptionsPropertyGroupTest extends TestCase $this->stub->addProperty('2'); $this->assertEquals( - [1, 2, 3, '2'], + [ + 1, + 2, + 3, + '2', + ], $properties->getValue($this->stub) ); } @@ -82,7 +87,7 @@ class OptionsPropertyGroupTest extends TestCase [ 0 => 1, 1 => 2, - 3 => 3 + 3 => 3, ], $properties->getValue($this->stub) ); @@ -113,7 +118,11 @@ class OptionsPropertyGroupTest extends TestCase $properties->setValue($this->stub, [1, 2, 3]); $this->assertEquals( - [1, 2, 3], + [ + 1, + 2, + 3, + ], $this->stub->getProperties() ); } diff --git a/test/classes/Properties/Options/OptionsPropertyOneItemTest.php b/test/classes/Properties/Options/OptionsPropertyOneItemTest.php index ade432b439..5d55e8c26a 100644 --- a/test/classes/Properties/Options/OptionsPropertyOneItemTest.php +++ b/test/classes/Properties/Options/OptionsPropertyOneItemTest.php @@ -52,7 +52,10 @@ class OptionsPropertyOneItemTest extends TestCase $this->stub->setValues([1, 2]); $this->assertEquals( - [1, 2], + [ + 1, + 2, + ], $this->stub->getValues() ); } diff --git a/test/classes/RelationTest.php b/test/classes/RelationTest.php index 742bf38cf8..42570fd3c4 100644 --- a/test/classes/RelationTest.php +++ b/test/classes/RelationTest.php @@ -221,13 +221,13 @@ class RelationTest extends TestCase [ 'Field' => 'field1', 'Type' => 'int(11)', - 'Comment' => 'Comment1' + 'Comment' => 'Comment1', ], [ 'Field' => 'field2', 'Type' => 'text', - 'Comment' => 'Comment1' - ] + 'Comment' => 'Comment1', + ], ]; $dbi->expects($this->any())->method('getColumns') ->will($this->returnValue($getColumnsResult)); @@ -246,7 +246,7 @@ class RelationTest extends TestCase $this->assertEquals( [ 'field1' => 'Comment1', - 'field2' => 'Comment1' + 'field2' => 'Comment1', ], $this->relation->getComments($db, $table) ); @@ -304,19 +304,25 @@ class RelationTest extends TestCase 'master_field' => 'value', 'foreign_db' => 'GSoC14', 'foreign_table' => 'test', - 'foreign_field' => 'value' + 'foreign_field' => 'value', ], 'foreign_keys_data' => [ 0 => [ 'constraint' => 'ad', - 'index_list' => ['id', 'value'], + 'index_list' => [ + 'id', + 'value', + ], 'ref_db_name' => 'GSoC14', 'ref_table_name' => 'table_1', - 'ref_index_list' => ['id', 'value'], + 'ref_index_list' => [ + 'id', + 'value', + ], 'on_delete' => 'CASCADE', 'on_update' => 'CASCADE' - ] - ] + ], + ], ]; $foreigner = $this->relation->searchColumnInForeigners($foreigners, 'id'); diff --git a/test/classes/ReplicationGuiTest.php b/test/classes/ReplicationGuiTest.php index c2739936d5..c7268251f9 100644 --- a/test/classes/ReplicationGuiTest.php +++ b/test/classes/ReplicationGuiTest.php @@ -67,8 +67,14 @@ class ReplicationGuiTest extends TestCase //Mock DBI $slave_host = [ - ['Server_id' => 'Server_id1', 'Host' => 'Host1'], - ['Server_id' => 'Server_id2', 'Host' => 'Host2'], + [ + 'Server_id' => 'Server_id1', + 'Host' => 'Host1' + ], + [ + 'Server_id' => 'Server_id2', + 'Host' => 'Host2' + ], ]; $fetchResult = [ @@ -78,7 +84,7 @@ class ReplicationGuiTest extends TestCase null, DatabaseInterface::CONNECT_USER, 0, - $slave_host + $slave_host, ], ]; @@ -94,7 +100,7 @@ class ReplicationGuiTest extends TestCase "Field" => "host", "Type" => "char(60)", "Null" => "NO", - ] + ], ]; $dbi->expects($this->any())->method('getColumns') ->will($this->returnValue($fields_info)); diff --git a/test/classes/Rte/EventsTest.php b/test/classes/Rte/EventsTest.php index c251dd35fc..f27856ccf0 100644 --- a/test/classes/Rte/EventsTest.php +++ b/test/classes/Rte/EventsTest.php @@ -108,7 +108,7 @@ class EventsTest extends TestCase 'item_definition' => '', 'item_preserve' => '', 'item_comment' => '', - 'item_definer' => '' + 'item_definer' => '', ], [ 'item_name' => '', @@ -124,8 +124,8 @@ class EventsTest extends TestCase 'item_definition' => '', 'item_preserve' => '', 'item_comment' => '', - 'item_definer' => '' - ] + 'item_definer' => '', + ], ], [ [ @@ -141,7 +141,7 @@ class EventsTest extends TestCase 'item_definition' => 'foo', 'item_preserve' => 'foo', 'item_comment' => 'foo', - 'item_definer' => 'foo' + 'item_definer' => 'foo', ], [ 'item_name' => 'foo', @@ -157,8 +157,8 @@ class EventsTest extends TestCase 'item_definition' => 'foo', 'item_preserve' => 'foo', 'item_comment' => 'foo', - 'item_definer' => 'foo' - ] + 'item_definer' => 'foo', + ], ], ]; } @@ -203,50 +203,50 @@ class EventsTest extends TestCase 'item_definition' => '', 'item_preserve' => '', 'item_comment' => '', - 'item_definer' => '' + 'item_definer' => '', ]; return [ [ $data, - "<input name='add_item'" + "<input name='add_item'", ], [ $data, - "<input type='text' name='item_name'" + "<input type='text' name='item_name'", ], [ $data, - "<select name='item_status'" + "<select name='item_status'", ], [ $data, - "<input name='item_type'" + "<input name='item_type'", ], [ $data, - "<input type='text' name='item_execute_at'" + "<input type='text' name='item_execute_at'", ], [ $data, - "<input type='text' name='item_ends'" + "<input type='text' name='item_ends'", ], [ $data, - "<textarea name='item_definition'" + "<textarea name='item_definition'", ], [ $data, - "<input type='text' name='item_definer'" + "<input type='text' name='item_definer'", ], [ $data, - "<input type='text' name='item_comment'" + "<input type='text' name='item_comment'", ], [ $data, - "<input type='submit' name='editor_process_add'" - ] + "<input type='submit' name='editor_process_add'", + ], ]; } @@ -290,50 +290,50 @@ class EventsTest extends TestCase 'item_definition' => 'SET @A=1;', 'item_preserve' => '', 'item_comment' => '', - 'item_definer' => '' + 'item_definer' => '', ]; return [ [ $data, - "<input name='edit_item'" + "<input name='edit_item'", ], [ $data, - "<input type='text' name='item_name'" + "<input type='text' name='item_name'", ], [ $data, - "<select name='item_status'" + "<select name='item_status'", ], [ $data, - "<input name='item_type'" + "<input name='item_type'", ], [ $data, - "<input type='text' name='item_execute_at'" + "<input type='text' name='item_execute_at'", ], [ $data, - "<input type='text' name='item_ends'" + "<input type='text' name='item_ends'", ], [ $data, - "<textarea name='item_definition'" + "<textarea name='item_definition'", ], [ $data, - "<input type='text' name='item_definer'" + "<input type='text' name='item_definer'", ], [ $data, - "<input type='text' name='item_comment'" + "<input type='text' name='item_comment'", ], [ $data, - "<input type='submit' name='editor_process_edit'" - ] + "<input type='submit' name='editor_process_edit'", + ], ]; } @@ -379,22 +379,22 @@ class EventsTest extends TestCase 'item_definition' => '', 'item_preserve' => '', 'item_comment' => '', - 'item_definer' => '' + 'item_definer' => '', ]; return [ [ $data, - "<select name='item_type'" + "<select name='item_type'", ], [ $data, - "<input type='hidden' name='editor_process_edit'" + "<input type='hidden' name='editor_process_edit'", ], [ $data, - "<input type='hidden' name='ajax_request'" - ] + "<input type='hidden' name='ajax_request'", + ], ]; } @@ -445,11 +445,11 @@ class EventsTest extends TestCase 'item_name' => 's o m e e v e n t\\', 'item_type' => 'ONE TIME', 'item_execute_at' => '2050-01-01 00:00:00', - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE EVENT `s o m e e v e n t\` ON SCHEDULE AT \'2050-01-01 ' . '00:00:00\' ON COMPLETION NOT PRESERVE DO SET @A=0;', - 0 + 0, ], [ [ // full once-off event @@ -459,11 +459,11 @@ class EventsTest extends TestCase 'item_execute_at' => '2050-01-01 00:00:00', 'item_preserve' => 'ON', 'item_status' => 'ENABLED', - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE DEFINER=`me`@`home` EVENT `evn` ON SCHEDULE AT ' . '\'2050-01-01 00:00:00\' ON COMPLETION PRESERVE ENABLE DO SET @A=0;', - 0 + 0, ], [ [ // simple recurring event @@ -472,11 +472,11 @@ class EventsTest extends TestCase 'item_interval_value' => '365', 'item_interval_field' => 'DAY', 'item_status' => 'DISABLED', - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE EVENT `rec_````evn` ON SCHEDULE EVERY 365 DAY ON ' . 'COMPLETION NOT PRESERVE DISABLE DO SET @A=0;', - 0 + 0, ], [ [ // full recurring event @@ -489,19 +489,19 @@ class EventsTest extends TestCase 'item_ends' => '2050-01-01', 'item_preserve' => 'ON', 'item_status' => 'SLAVESIDE_DISABLED', - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE DEFINER=`evil````user><\`@`work\` EVENT `rec_evn2` ON ' . 'SCHEDULE EVERY 365 DAY STARTS \'1900-01-01\' ENDS \'2050-01-01\' ' . 'ON COMPLETION PRESERVE DISABLE ON SLAVE DO SET @A=0;', - 0 + 0, ], // Testing failures [ [ // empty request ], 'CREATE EVENT ON SCHEDULE ON COMPLETION NOT PRESERVE DO ', - 3 + 3, ], [ [ @@ -509,11 +509,11 @@ class EventsTest extends TestCase 'item_definer' => 'someuser', // invalid definer format 'item_type' => 'ONE TIME', 'item_execute_at' => '', // no execution time - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE EVENT `s o m e e v e n t\` ON SCHEDULE ON COMPLETION NOT ' . 'PRESERVE DO SET @A=0;', - 2 + 2, ], [ [ @@ -522,11 +522,11 @@ class EventsTest extends TestCase 'item_interval_value' => '', // no interval value 'item_interval_field' => 'DAY', 'item_status' => 'DISABLED', - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE EVENT `rec_````evn` ON SCHEDULE ON COMPLETION NOT ' . 'PRESERVE DISABLE DO SET @A=0;', - 1 + 1, ], [ [ // simple recurring event @@ -535,11 +535,11 @@ class EventsTest extends TestCase 'item_interval_value' => '365', 'item_interval_field' => 'CENTURIES', // invalid interval field 'item_status' => 'DISABLED', - 'item_definition' => 'SET @A=0;' + 'item_definition' => 'SET @A=0;', ], 'CREATE EVENT `rec_````evn` ON SCHEDULE ON COMPLETION NOT ' . 'PRESERVE DISABLE DO SET @A=0;', - 1 + 1, ], ]; } diff --git a/test/classes/Rte/RoutinesTest.php b/test/classes/Rte/RoutinesTest.php index 3d5f4e435d..d6425f3559 100644 --- a/test/classes/Rte/RoutinesTest.php +++ b/test/classes/Rte/RoutinesTest.php @@ -138,8 +138,8 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' - ] + 'item_sqldataaccess' => '', + ], ], [ [ @@ -154,12 +154,30 @@ class RoutinesTest extends TestCase 'item_type' => 'PROCEDURE', 'item_type_toggle' => 'FUNCTION', 'item_original_type' => 'PROCEDURE', - 'item_param_dir' => [0 => 'IN', 1 => 'FAIL'], - 'item_param_name' => [0 => 'bar', 1 => 'baz'], - 'item_param_type' => [0 => 'INT', 1 => 'FAIL'], - 'item_param_length' => [0 => '20', 1 => ''], - 'item_param_opts_num' => [0 => 'UNSIGNED', 1 => ''], - 'item_param_opts_text' => [0 => '', 1 => 'latin1'], + 'item_param_dir' => [ + 0 => 'IN', + 1 => 'FAIL', + ], + 'item_param_name' => [ + 0 => 'bar', + 1 => 'baz', + ], + 'item_param_type' => [ + 0 => 'INT', + 1 => 'FAIL', + ], + 'item_param_length' => [ + 0 => '20', + 1 => '', + ], + 'item_param_opts_num' => [ + 0 => 'UNSIGNED', + 1 => '', + ], + 'item_param_opts_text' => [ + 0 => '', + 1 => 'latin1', + ], 'item_returntype' => '', 'item_isdeterministic' => 'ON', 'item_securitytype' => 'INVOKER', @@ -178,18 +196,36 @@ class RoutinesTest extends TestCase 'item_type_toggle' => 'FUNCTION', 'item_original_type' => 'PROCEDURE', 'item_num_params' => 2, - 'item_param_dir' => [0 => 'IN', 1 => ''], - 'item_param_name' => [0 => 'bar', 1 => 'baz'], - 'item_param_type' => [0 => 'INT', 1 => ''], - 'item_param_length' => [0 => '20', 1 => ''], - 'item_param_opts_num' => [0 => 'UNSIGNED', 1 => ''], - 'item_param_opts_text' => [0 => '', 1 => 'latin1'], + 'item_param_dir' => [ + 0 => 'IN', + 1 => '', + ], + 'item_param_name' => [ + 0 => 'bar', + 1 => 'baz', + ], + 'item_param_type' => [ + 0 => 'INT', + 1 => '', + ], + 'item_param_length' => [ + 0 => '20', + 1 => '', + ], + 'item_param_opts_num' => [ + 0 => 'UNSIGNED', + 1 => '', + ], + 'item_param_opts_text' => [ + 0 => '', + 1 => 'latin1', + ], 'item_returntype' => '', 'item_isdeterministic' => ' checked=\'checked\'', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => ' selected=\'selected\'', - 'item_sqldataaccess' => 'NO SQL' - ] + 'item_sqldataaccess' => 'NO SQL', + ], ], [ [ @@ -204,15 +240,30 @@ class RoutinesTest extends TestCase 'item_type' => 'FUNCTION', 'item_type_toggle' => 'PROCEDURE', 'item_original_type' => 'FUNCTION', - 'item_param_dir' => [0 => '', 1 => ''], - 'item_param_name' => [0 => 'bar', 1 => 'baz'], + 'item_param_dir' => [ + 0 => '', + 1 => '', + ], + 'item_param_name' => [ + 0 => 'bar', + 1 => 'baz', + ], 'item_param_type' => [ 0 => '<s>XSS</s>', - 1 => 'TEXT' + 1 => 'TEXT', + ], + 'item_param_length' => [ + 0 => '10,10', + 1 => '', + ], + 'item_param_opts_num' => [ + 0 => 'UNSIGNED', + 1 => '', + ], + 'item_param_opts_text' => [ + 0 => '', + 1 => 'utf8', ], - 'item_param_length' => [0 => '10,10', 1 => ''], - 'item_param_opts_num' => [0 => 'UNSIGNED', 1 => ''], - 'item_param_opts_text' => [0 => '', 1 => 'utf8'], 'item_returntype' => 'VARCHAR', 'item_isdeterministic' => '', 'item_securitytype' => 'DEFINER', @@ -232,17 +283,32 @@ class RoutinesTest extends TestCase 'item_original_type' => 'FUNCTION', 'item_num_params' => '2', 'item_param_dir' => [], - 'item_param_name' => [0 => 'bar', 1 => 'baz'], - 'item_param_type' => [0 => '', 1 => 'TEXT'], - 'item_param_length' => [0 => '10,10', 1 => ''], - 'item_param_opts_num' => [0 => 'UNSIGNED', 1 => ''], - 'item_param_opts_text' => [0 => '', 1 => 'utf8'], + 'item_param_name' => [ + 0 => 'bar', + 1 => 'baz', + ], + 'item_param_type' => [ + 0 => '', + 1 => 'TEXT', + ], + 'item_param_length' => [ + 0 => '10,10', + 1 => '', + ], + 'item_param_opts_num' => [ + 0 => 'UNSIGNED', + 1 => '', + ], + 'item_param_opts_text' => [ + 0 => '', + 1 => 'utf8', + ], 'item_returntype' => 'VARCHAR', 'item_isdeterministic' => '', 'item_securitytype_definer' => ' selected=\'selected\'', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' - ] + 'item_sqldataaccess' => '', + ], ], ]; } @@ -309,34 +375,34 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' + 'item_sqldataaccess' => '', ]; return [ [ $data, 0, - "<select name='item_param_dir[0]'" + "<select name='item_param_dir[0]'", ], [ $data, 0, - "<input name='item_param_name[0]'" + "<input name='item_param_name[0]'", ], [ $data, 0, - "<select name='item_param_type[0]'" + "<select name='item_param_type[0]'", ], [ $data, 0, - "<select name='item_param_opts_num[0]'" + "<select name='item_param_opts_num[0]'", ], [ $data, 0, - "<a href='#' class='routine_param_remove_anchor'" + "<a href='#' class='routine_param_remove_anchor'", ], ]; } @@ -393,30 +459,30 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' + 'item_sqldataaccess' => '', ]; return [ [ $data, - "<select name='item_param_dir[%s]'" + "<select name='item_param_dir[%s]'", ], [ $data, - "<input name='item_param_name[%s]'" + "<input name='item_param_name[%s]'", ], [ $data, - "<select name='item_param_dir[%s]'" + "<select name='item_param_dir[%s]'", ], [ $data, - "<select name='item_param_opts_num[%s]'" + "<select name='item_param_opts_num[%s]'", ], [ $data, - "<a href='#' class='routine_param_remove_anchor'" - ] + "<a href='#' class='routine_param_remove_anchor'", + ], ]; } @@ -470,74 +536,74 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' + 'item_sqldataaccess' => '', ]; return [ [ $data, - "<input name='add_item'" + "<input name='add_item'", ], [ $data, - "<input type='text' name='item_name'" + "<input type='text' name='item_name'", ], [ $data, - "<input name='item_type'" + "<input name='item_type'", ], [ $data, - "name='routine_changetype'" + "name='routine_changetype'", ], [ $data, - "name='routine_addparameter'" + "name='routine_addparameter'", ], [ $data, - "name='routine_removeparameter'" + "name='routine_removeparameter'", ], [ $data, - "select name='item_returntype'" + "select name='item_returntype'", ], [ $data, - "name='item_returnlength'" + "name='item_returnlength'", ], [ $data, - "select name='item_returnopts_num'" + "select name='item_returnopts_num'", ], [ $data, - "<textarea name='item_definition'" + "<textarea name='item_definition'", ], [ $data, - "name='item_isdeterministic'" + "name='item_isdeterministic'", ], [ $data, - "name='item_definer'" + "name='item_definer'", ], [ $data, - "select name='item_securitytype'" + "select name='item_securitytype'", ], [ $data, - "select name='item_sqldataaccess'" + "select name='item_sqldataaccess'", ], [ $data, - "name='item_comment'" + "name='item_comment'", ], [ $data, - "name='editor_process_add'" - ] + "name='editor_process_add'", + ], ]; } @@ -591,74 +657,74 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => 'NO SQL' + 'item_sqldataaccess' => 'NO SQL', ]; return [ [ $data, - "name='edit_item'" + "name='edit_item'", ], [ $data, - "name='item_name'" + "name='item_name'", ], [ $data, - "<input name='item_type' type='hidden' value='FUNCTION'" + "<input name='item_type' type='hidden' value='FUNCTION'", ], [ $data, - "name='routine_changetype'" + "name='routine_changetype'", ], [ $data, - "name='routine_addparameter'" + "name='routine_addparameter'", ], [ $data, - "name='routine_removeparameter'" + "name='routine_removeparameter'", ], [ $data, - "name='item_returntype'" + "name='item_returntype'", ], [ $data, - "name='item_returnlength'" + "name='item_returnlength'", ], [ $data, - "name='item_returnopts_num'" + "name='item_returnopts_num'", ], [ $data, - "<textarea name='item_definition'" + "<textarea name='item_definition'", ], [ $data, - "name='item_isdeterministic'" + "name='item_isdeterministic'", ], [ $data, - "name='item_definer'" + "name='item_definer'", ], [ $data, - "<select name='item_securitytype'" + "<select name='item_securitytype'", ], [ $data, - "<select name='item_sqldataaccess'" + "<select name='item_sqldataaccess'", ], [ $data, - "name='item_comment'" + "name='item_comment'", ], [ $data, - "name='editor_process_edit'" - ] + "name='editor_process_edit'", + ], ]; } @@ -714,73 +780,73 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => 'NO SQL' + 'item_sqldataaccess' => 'NO SQL', ]; return [ [ $data, - "name='edit_item'" + "name='edit_item'", ], [ $data, - "name='item_name'" + "name='item_name'", ], [ $data, - "<select name='item_type'" + "<select name='item_type'", ], [ $data, - "name='routine_addparameter'" + "name='routine_addparameter'", ], [ $data, - "name='routine_removeparameter'" + "name='routine_removeparameter'", ], [ $data, - "<select name='item_returntype'" + "<select name='item_returntype'", ], [ $data, - "name='item_returnlength'" + "name='item_returnlength'", ], [ $data, - "<select name='item_returnopts_num'" + "<select name='item_returnopts_num'", ], [ $data, - "<textarea name='item_definition'" + "<textarea name='item_definition'", ], [ $data, - "name='item_isdeterministic'" + "name='item_isdeterministic'", ], [ $data, - "name='item_definer'" + "name='item_definer'", ], [ $data, - "<select name='item_securitytype'" + "<select name='item_securitytype'", ], [ $data, - "<select name='item_sqldataaccess'" + "<select name='item_sqldataaccess'", ], [ $data, - "name='item_comment'" + "name='item_comment'", ], [ $data, - "name='ajax_request'" + "name='ajax_request'", ], [ $data, - "name='editor_process_edit'" + "name='editor_process_edit'", ], ]; } @@ -835,13 +901,13 @@ class RoutinesTest extends TestCase 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => 'NO SQL' + 'item_sqldataaccess' => 'NO SQL', ]; return [ [ $data, - "<input name='item_type' type='hidden' value='PROCEDURE'" + "<input name='item_type' type='hidden' value='PROCEDURE'", ], ]; } @@ -890,7 +956,7 @@ class RoutinesTest extends TestCase 2 => 'IN', 3 => 'IN', 4 => 'IN', - 5 => 'IN' + 5 => 'IN', ], 'item_param_name' => [ 0 => 'foo', @@ -898,7 +964,7 @@ class RoutinesTest extends TestCase 2 => 'fob', 3 => 'foc', 4 => 'fod', - 5 => 'foe' + 5 => 'foe', ], 'item_param_type' => [ 0 => 'DATE', @@ -906,7 +972,7 @@ class RoutinesTest extends TestCase 2 => 'DATETIME', 3 => 'GEOMETRY', 4 => 'ENUM', - 5 => 'SET' + 5 => 'SET', ], 'item_param_length' => [ 0 => '', @@ -914,15 +980,21 @@ class RoutinesTest extends TestCase 2 => '', 3 => '', 4 => "'a','b'", - 5 => "'a','b'" + 5 => "'a','b'", ], 'item_param_length_arr' => [ 0 => [], 1 => ['22'], 2 => [], 3 => [], - 4 => ["'a'", "'b'"], - 5 => ["'a'", "'b'"] + 4 => [ + "'a'", + "'b'", + ], + 5 => [ + "'a'", + "'b'", + ], ], 'item_param_opts_num' => [ 0 => '', @@ -930,7 +1002,7 @@ class RoutinesTest extends TestCase 2 => '', 3 => '', 4 => '', - 5 => '' + 5 => '', ], 'item_param_opts_text' => [ 0 => '', @@ -938,47 +1010,47 @@ class RoutinesTest extends TestCase 2 => '', 3 => '', 4 => '', - 5 => '' + 5 => '', ], 'item_returntype' => '', 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' + 'item_sqldataaccess' => '', ]; return [ [ $data, - "name='item_name'" + "name='item_name'", ], [ $data, - "name='funcs[foo]'" + "name='funcs[foo]'", ], [ $data, - "<input class='datefield' type='text' name='params[foo]'>" + "<input class='datefield' type='text' name='params[foo]'>", ], [ $data, - "name='funcs[fob]'" + "name='funcs[fob]'", ], [ $data, - "<input class='datetimefield' type='text' name='params[fob]'" + "<input class='datetimefield' type='text' name='params[fob]'", ], [ $data, - "name='params[fod][]'" + "name='params[fod][]'", ], [ $data, - "name='params[foe][]'" + "name='params[foe][]'", ], [ $data, - "name='execute_routine'" + "name='execute_routine'", ], ]; } @@ -1027,7 +1099,7 @@ class RoutinesTest extends TestCase 2 => 'IN', 3 => 'IN', 4 => 'IN', - 5 => 'IN' + 5 => 'IN', ], 'item_param_name' => [ 0 => 'foo', @@ -1035,7 +1107,7 @@ class RoutinesTest extends TestCase 2 => 'fob', 3 => 'foc', 4 => 'fod', - 5 => 'foe' + 5 => 'foe', ], 'item_param_type' => [ 0 => 'DATE', @@ -1043,7 +1115,7 @@ class RoutinesTest extends TestCase 2 => 'DATETIME', 3 => 'GEOMETRY', 4 => 'ENUM', - 5 => 'SET' + 5 => 'SET', ], 'item_param_length' => [ 0 => '', @@ -1051,15 +1123,21 @@ class RoutinesTest extends TestCase 2 => '', 3 => '', 4 => "'a','b'", - 5 => "'a','b'" + 5 => "'a','b'", ], 'item_param_length_arr' => [ 0 => [], 1 => ['22'], 2 => [], 3 => [], - 4 => ["'a'", "'b'"], - 5 => ["'a'", "'b'"] + 4 => [ + "'a'", + "'b'", + ], + 5 => [ + "'a'", + "'b'", + ], ], 'item_param_opts_num' => [ 0 => '', @@ -1067,7 +1145,7 @@ class RoutinesTest extends TestCase 2 => '', 3 => '', 4 => '', - 5 => '' + 5 => '', ], 'item_param_opts_text' => [ 0 => '', @@ -1075,23 +1153,23 @@ class RoutinesTest extends TestCase 2 => '', 3 => '', 4 => '', - 5 => '' + 5 => '', ], 'item_returntype' => '', 'item_isdeterministic' => '', 'item_securitytype_definer' => '', 'item_securitytype_invoker' => '', - 'item_sqldataaccess' => '' + 'item_sqldataaccess' => '', ]; return [ [ $data, - "name='execute_routine'" + "name='execute_routine'", ], [ $data, - "name='ajax_request'" + "name='ajax_request'", ], ]; } @@ -1126,9 +1204,21 @@ class RoutinesTest extends TestCase ->will( $this->returnValueMap( [ - ['foo', DatabaseInterface::CONNECT_USER, 'foo'], - ["foo's bar", DatabaseInterface::CONNECT_USER, "foo\'s bar"], - ['', DatabaseInterface::CONNECT_USER, ''] + [ + 'foo', + DatabaseInterface::CONNECT_USER, + 'foo', + ], + [ + "foo's bar", + DatabaseInterface::CONNECT_USER, + "foo\'s bar", + ], + [ + '', + DatabaseInterface::CONNECT_USER, + '', + ], ] ) ); @@ -1178,7 +1268,7 @@ class RoutinesTest extends TestCase ], 'CREATE DEFINER=`me`@`home` PROCEDURE `p r o c`() COMMENT \'foo\' ' . 'DETERMINISTIC NO SQL SQL SECURITY INVOKER SELECT 0;', - 0 + 0, ], [ [ @@ -1191,12 +1281,30 @@ class RoutinesTest extends TestCase 'item_definer' => 'someuser@somehost', 'item_type' => 'PROCEDURE', 'item_num_params' => '2', - 'item_param_dir' => ['IN', 'INOUT'], - 'item_param_name' => ['pa`ram', 'par 2'], - 'item_param_type' => ['INT', 'ENUM'], - 'item_param_length' => ['10', '\'a\', \'b\''], - 'item_param_opts_num' => ['ZEROFILL', ''], - 'item_param_opts_text' => ['utf8', 'latin1'], + 'item_param_dir' => [ + 'IN', + 'INOUT', + ], + 'item_param_name' => [ + 'pa`ram', + 'par 2', + ], + 'item_param_type' => [ + 'INT', + 'ENUM', + ], + 'item_param_length' => [ + '10', + '\'a\', \'b\'', + ], + 'item_param_opts_num' => [ + 'ZEROFILL', + '', + ], + 'item_param_opts_text' => [ + 'utf8', + 'latin1', + ], 'item_returntype' => '', 'item_securitytype' => 'DEFINER', 'item_sqldataaccess' => 'foobar' @@ -1205,7 +1313,7 @@ class RoutinesTest extends TestCase . '(IN `pa``ram` INT(10) ZEROFILL, INOUT `par 2` ENUM(\'a\', \'b\')' . ' CHARSET latin1) NOT DETERMINISTIC SQL SECURITY DEFINER SELECT ' . '\'foobar\';', - 0 + 0, ], [ [ @@ -1232,7 +1340,7 @@ class RoutinesTest extends TestCase 'CREATE FUNCTION `func\\`(`pa``ram` VARCHAR(45) CHARSET latin1) ' . 'RETURNS DECIMAL(5,5) UNSIGNED ZEROFILL COMMENT \'foo\\\'s bar\' ' . 'DETERMINISTIC SQL SECURITY DEFINER SELECT \'foobar\';', - 0 + 0, ], [ [ @@ -1251,14 +1359,13 @@ class RoutinesTest extends TestCase ], 'CREATE FUNCTION `func`() RETURNS VARCHAR(20) CHARSET utf8 NOT ' . 'DETERMINISTIC SQL SECURITY DEFINER SELECT 0;', - 0 + 0, ], // Testing failures [ - [ - ], + [], 'CREATE () NOT DETERMINISTIC ', // invalid query - 3 + 3, ], [ [ @@ -1284,7 +1391,7 @@ class RoutinesTest extends TestCase ], 'CREATE PROCEDURE `proc`() COMMENT \'foo\' DETERMINISTIC ' . 'NO SQL SQL SECURITY INVOKER SELECT 0;', // valid query - 1 + 1, ], [ [ @@ -1297,12 +1404,30 @@ class RoutinesTest extends TestCase 'item_definer' => '', 'item_type' => 'PROCEDURE', 'item_num_params' => '2', - 'item_param_dir' => ['FAIL', 'INOUT'], // invalid direction - 'item_param_name' => ['pa`ram', 'goo'], - 'item_param_type' => ['INT', 'ENUM'], - 'item_param_length' => ['10', ''], // missing ENUM values - 'item_param_opts_num' => ['ZEROFILL', ''], - 'item_param_opts_text' => ['utf8', 'latin1'], + 'item_param_dir' => [ + 'FAIL', + 'INOUT', + ], // invalid direction + 'item_param_name' => [ + 'pa`ram', + 'goo', + ], + 'item_param_type' => [ + 'INT', + 'ENUM', + ], + 'item_param_length' => [ + '10', + '', + ], // missing ENUM values + 'item_param_opts_num' => [ + 'ZEROFILL', + '', + ], + 'item_param_opts_text' => [ + 'utf8', + 'latin1', + ], 'item_returntype' => '', 'item_securitytype' => 'DEFINER', 'item_sqldataaccess' => 'foobar' // invalid, will just be ignored without throwing errors @@ -1310,7 +1435,7 @@ class RoutinesTest extends TestCase 'CREATE PROCEDURE `proc`((10) ZEROFILL, ' . 'INOUT `goo` ENUM CHARSET latin1) NOT DETERMINISTIC ' . 'SQL SECURITY DEFINER SELECT 0;', // invalid query - 2 + 2, ], [ [ @@ -1335,7 +1460,7 @@ class RoutinesTest extends TestCase ], 'CREATE FUNCTION `func`() RETURNS VARCHAR CHARSET utf8 NOT ' . 'DETERMINISTIC SQL SECURITY DEFINER SELECT 0;', // invalid query - 2 + 2, ], [ [ @@ -1354,7 +1479,7 @@ class RoutinesTest extends TestCase ], 'CREATE FUNCTION `func`() NOT DETERMINISTIC SQL ' . 'SECURITY DEFINER SELECT 0;', // invalid query - 1 + 1, ], ]; } diff --git a/test/classes/Rte/TriggersTest.php b/test/classes/Rte/TriggersTest.php index afd4f71d16..ab7e44448b 100644 --- a/test/classes/Rte/TriggersTest.php +++ b/test/classes/Rte/TriggersTest.php @@ -88,7 +88,7 @@ class TriggersTest extends TestCase 'item_action_timing' => '', 'item_event_manipulation' => '', 'item_definition' => '', - 'item_definer' => '' + 'item_definer' => '', ], [ 'item_name' => '', @@ -97,8 +97,8 @@ class TriggersTest extends TestCase 'item_action_timing' => '', 'item_event_manipulation' => '', 'item_definition' => '', - 'item_definer' => '' - ] + 'item_definer' => '', + ], ], [ [ @@ -108,7 +108,7 @@ class TriggersTest extends TestCase 'item_action_timing' => 'foo', 'item_event_manipulation' => 'foo', 'item_definition' => 'foo', - 'item_definer' => 'foo' + 'item_definer' => 'foo', ], [ 'item_name' => 'foo', @@ -117,9 +117,9 @@ class TriggersTest extends TestCase 'item_action_timing' => 'foo', 'item_event_manipulation' => 'foo', 'item_definition' => 'foo', - 'item_definer' => 'foo' - ] - ] + 'item_definer' => 'foo', + ], + ], ]; } @@ -158,42 +158,42 @@ class TriggersTest extends TestCase 'item_action_timing' => '', 'item_event_manipulation' => '', 'item_definition' => '', - 'item_definer' => '' + 'item_definer' => '', ]; return [ [ $data, - "name='add_item'" + "name='add_item'", ], [ $data, - "name='item_name'" + "name='item_name'", ], [ $data, - "name='item_table'" + "name='item_table'", ], [ $data, - "name='item_timing'" + "name='item_timing'", ], [ $data, - "name='item_event'" + "name='item_event'", ], [ $data, - "name='item_definition'" + "name='item_definition'", ], [ $data, - "name='item_definer'" + "name='item_definer'", ], [ $data, - "name='editor_process_add'" - ] + "name='editor_process_add'", + ], ]; } @@ -232,42 +232,42 @@ class TriggersTest extends TestCase 'item_action_timing' => 'BEFORE', 'item_event_manipulation' => 'INSERT', 'item_definition' => 'SET @A=1;', - 'item_definer' => '' + 'item_definer' => '', ]; return [ [ $data, - "name='edit_item'" + "name='edit_item'", ], [ $data, - "name='item_name'" + "name='item_name'", ], [ $data, - "name='item_table'" + "name='item_table'", ], [ $data, - "name='item_timing'" + "name='item_timing'", ], [ $data, - "name='item_event'" + "name='item_event'", ], [ $data, - "name='item_definition'" + "name='item_definition'", ], [ $data, - "name='item_definer'" + "name='item_definer'", ], [ $data, - "name='editor_process_edit'" - ] + "name='editor_process_edit'", + ], ]; } @@ -307,18 +307,18 @@ class TriggersTest extends TestCase 'item_action_timing' => 'BEFORE', 'item_event_manipulation' => 'INSERT', 'item_definition' => 'SET @A=1;', - 'item_definer' => '' + 'item_definer' => '', ]; return [ [ $data, - "name='editor_process_edit'" + "name='editor_process_edit'", ], [ $data, - "name='ajax_request'" - ] + "name='ajax_request'", + ], ]; } @@ -373,14 +373,15 @@ class TriggersTest extends TestCase public function providerGetQueryFromRequest() { return [ - ['', + [ + '', '', '', '', '', '', 'CREATE TRIGGER ON FOR EACH ROW ', - 5 + 5, ], [ 'root', @@ -390,7 +391,7 @@ class TriggersTest extends TestCase 'table`2', 'SET @A=NULL', 'CREATE TRIGGER `trigger` BEFORE INSERT ON FOR EACH ROW SET @A=NULL', - 2 + 2, ], [ 'foo`s@host', @@ -400,7 +401,7 @@ class TriggersTest extends TestCase 'table3', 'BEGIN SET @A=1; SET @B=2; END', 'CREATE DEFINER=`foo``s`@`host` TRIGGER `trigger``s test` AFTER ON FOR EACH ROW BEGIN SET @A=1; SET @B=2; END', - 2 + 2, ], [ 'root@localhost', @@ -410,7 +411,7 @@ class TriggersTest extends TestCase 'table1', 'SET @A=NULL', 'CREATE DEFINER=`root`@`localhost` TRIGGER `trigger` BEFORE INSERT ON `table1` FOR EACH ROW SET @A=NULL', - 0 + 0, ], ]; } diff --git a/test/classes/SanitizeTest.php b/test/classes/SanitizeTest.php index 96676745d2..1f4be5405c 100644 --- a/test/classes/SanitizeTest.php +++ b/test/classes/SanitizeTest.php @@ -77,10 +77,22 @@ class SanitizeTest extends TestCase public function docLinks() { return [ - ['foo', 'setup.html%23foo'], - ['cfg_TitleTable', 'config.html%23cfg_TitleTable'], - ['faq3-11', 'faq.html%23faq3-11'], - ['bookmarks@', 'bookmarks.html'], + [ + 'foo', + 'setup.html%23foo', + ], + [ + 'cfg_TitleTable', + 'config.html%23cfg_TitleTable', + ], + [ + 'faq3-11', + 'faq.html%23faq3-11', + ], + [ + 'bookmarks@', + 'bookmarks.html', + ], ]; } @@ -190,7 +202,11 @@ class SanitizeTest extends TestCase { $this->assertEquals($expected, Sanitize::getJsValue($key, $value)); $this->assertEquals('foo = 100', Sanitize::getJsValue('foo', '100', false)); - $array = ['1','2','3']; + $array = [ + '1', + '2', + '3', + ]; $this->assertEquals( "foo = [\"1\",\"2\",\"3\",];\n", Sanitize::getJsValue('foo', $array) @@ -219,13 +235,41 @@ class SanitizeTest extends TestCase public function variables() { return [ - ['foo', true, "foo = true;\n"], - ['foo', false, "foo = false;\n"], - ['foo', 100, "foo = 100;\n"], - ['foo', 0, "foo = 0;\n"], - ['foo', 'text', "foo = \"text\";\n"], - ['foo', 'quote"', "foo = \"quote\\\"\";\n"], - ['foo', 'apostroph\'', "foo = \"apostroph\\'\";\n"], + [ + 'foo', + true, + "foo = true;\n", + ], + [ + 'foo', + false, + "foo = false;\n", + ], + [ + 'foo', + 100, + "foo = 100;\n", + ], + [ + 'foo', + 0, + "foo = 0;\n", + ], + [ + 'foo', + 'text', + "foo = \"text\";\n", + ], + [ + 'foo', + 'quote"', + "foo = \"quote\\\"\";\n", + ], + [ + 'foo', + 'apostroph\'', + "foo = \"apostroph\\'\";\n", + ], ]; } @@ -252,15 +296,30 @@ class SanitizeTest extends TestCase public function escapeDataProvider() { return [ - ['\\\';', '\';'], - ['\r\n\\\'<scrIpt></\' + \'script>', "\r\n'<scrIpt></sCRIPT>"], - ['\\\';[XSS]', '\';[XSS]'], + [ + '\\\';', + '\';', + ], + [ + '\r\n\\\'<scrIpt></\' + \'script>', + "\r\n'<scrIpt></sCRIPT>", + ], + [ + '\\\';[XSS]', + '\';[XSS]', + ], [ '</\' + \'script></head><body>[HTML]', - '</SCRIPT></head><body>[HTML]' + '</SCRIPT></head><body>[HTML]', + ], + [ + '\"\\\'\\\\\\\'\"', + '"\'\\\'"', + ], + [ + "\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", + "\\''''''''''''\\", ], - ['\"\\\'\\\\\\\'\"', '"\'\\\'"'], - ["\\\\\'\'\'\'\'\'\'\'\'\'\'\'\\\\", "\\''''''''''''\\"] ]; } @@ -274,7 +333,10 @@ class SanitizeTest extends TestCase $_REQUEST['foo'] = 'bar'; $_REQUEST['allow'] = 'all'; $_REQUEST['second'] = 1; - $allow_list = ['allow', 'second']; + $allow_list = [ + 'allow', + 'second', + ]; Sanitize::removeRequestVars($allow_list); $this->assertArrayNotHasKey('foo', $_REQUEST); $this->assertArrayNotHasKey('second', $_REQUEST); diff --git a/test/classes/ScriptsTest.php b/test/classes/ScriptsTest.php index b3d8730770..ccedaca4ce 100644 --- a/test/classes/ScriptsTest.php +++ b/test/classes/ScriptsTest.php @@ -87,8 +87,8 @@ class ScriptsTest extends PmaTestCase [ 'has_onload' => false, 'filename' => 'common.js' - ] - ] + ], + ], ] ) ); @@ -150,8 +150,14 @@ $(function() {}); $this->object->addFile('common.js'); $this->assertEquals( [ - ['name' => 'vendor/codemirror/lib/codemirror.js', 'fire' => 0], - ['name' => 'common.js', 'fire' => 1] + [ + 'name' => 'vendor/codemirror/lib/codemirror.js', + 'fire' => 0, + ], + [ + 'name' => 'common.js', + 'fire' => 1, + ], ], $this->object->getFiles() ); @@ -180,7 +186,7 @@ $(function() {}); 'has_onload' => 1, 'filename' => 'common.js', 'params' => [], - ] + ], ]; $this->object->addFile($file); $this->assertAttributeEquals( diff --git a/test/classes/Server/PrivilegesTest.php b/test/classes/Server/PrivilegesTest.php index 495638fe58..c5aaf9e53f 100644 --- a/test/classes/Server/PrivilegesTest.php +++ b/test/classes/Server/PrivilegesTest.php @@ -120,7 +120,7 @@ class PrivilegesTest extends TestCase $this->returnValue( [ 'grant user1 select', - 'grant user2 delete' + 'grant user2 delete', ] ) ); @@ -290,7 +290,7 @@ class PrivilegesTest extends TestCase [ 'Delete', 'DELETE', - $GLOBALS['strPrivDescDelete'] + $GLOBALS['strPrivDescDelete'], ], $ret[0] ); @@ -298,7 +298,7 @@ class PrivilegesTest extends TestCase [ 'Create', 'CREATE', - $GLOBALS['strPrivDescCreateTbl'] + $GLOBALS['strPrivDescCreateTbl'], ], $ret[1] ); @@ -316,7 +316,7 @@ class PrivilegesTest extends TestCase [ 'Select_priv', 'SELECT', - __('Allows reading data.') + __('Allows reading data.'), ], $ret[0] ); @@ -324,7 +324,7 @@ class PrivilegesTest extends TestCase [ 'Insert_priv', 'INSERT', - __('Allows inserting and replacing data.') + __('Allows inserting and replacing data.'), ], $ret[1] ); @@ -338,10 +338,10 @@ class PrivilegesTest extends TestCase public function testGetHtmlForColumnPrivileges() { $columns = [ - 'row1' => 'name1' + 'row1' => 'name1', ]; $row = [ - 'name_for_select' => 'Y' + 'name_for_select' => 'Y', ]; $name_for_select = 'name_for_select'; $priv_for_header = 'priv_for_header'; @@ -400,7 +400,7 @@ class PrivilegesTest extends TestCase /* Assertion 1 */ $row = [ 'ssl_type' => '', - 'ssh_cipher' => '' + 'ssh_cipher' => '', ]; $html = $this->serverPrivileges->getHtmlForRequires( @@ -431,7 +431,7 @@ class PrivilegesTest extends TestCase /* Assertion 2 */ $row = [ 'ssl_type' => 'ANY', - 'ssh_cipher' => '' + 'ssh_cipher' => '', ]; $html = $this->serverPrivileges->getHtmlForRequires( @@ -462,7 +462,7 @@ class PrivilegesTest extends TestCase /* Assertion 3 */ $row = [ 'ssl_type' => 'X509', - 'ssh_cipher' => '' + 'ssh_cipher' => '', ]; $html = $this->serverPrivileges->getHtmlForRequires( @@ -493,7 +493,7 @@ class PrivilegesTest extends TestCase /* Assertion 4 */ $row = [ 'ssl_type' => 'SPECIFIED', - 'ssh_cipher' => '' + 'ssh_cipher' => '', ]; $html = $this->serverPrivileges->getHtmlForRequires( @@ -1086,7 +1086,11 @@ class PrivilegesTest extends TestCase $dbi->expects($this->any())->method('tryQuery') ->will($this->returnValue(true)); - $columns = ['val1', 'replace1', 5]; + $columns = [ + 'val1', + 'replace1', + 5, + ]; $dbi->expects($this->at(0)) ->method('fetchRow') ->will($this->returnValue($columns)); @@ -1294,7 +1298,7 @@ class PrivilegesTest extends TestCase $db = "PMA_db"; $table = "PMA_table"; $columns = [ - 'row1' => 'name1' + 'row1' => 'name1', ]; $row = [ 'Select_priv' => 'Y', @@ -1372,8 +1376,14 @@ class PrivilegesTest extends TestCase ->disableOriginalConstructor() ->getMock(); $fields_info = [ - ['COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80], - ['COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40], + [ + 'COLUMN_NAME' => 'Host', + 'CHARACTER_MAXIMUM_LENGTH' => 80, + ], + [ + 'COLUMN_NAME' => 'User', + 'CHARACTER_MAXIMUM_LENGTH' => 40, + ], ]; $dbi->expects($this->any())->method('fetchResult') ->will($this->returnValue($fields_info)); @@ -1481,8 +1491,14 @@ class PrivilegesTest extends TestCase ->disableOriginalConstructor() ->getMock(); $fields_info = [ - ['COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80], - ['COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40], + [ + 'COLUMN_NAME' => 'Host', + 'CHARACTER_MAXIMUM_LENGTH' => 80, + ], + [ + 'COLUMN_NAME' => 'User', + 'CHARACTER_MAXIMUM_LENGTH' => 40, + ], ]; $dbi->expects($this->any())->method('fetchResult') ->will($this->returnValue($fields_info)); @@ -1556,8 +1572,14 @@ class PrivilegesTest extends TestCase ->disableOriginalConstructor() ->getMock(); $fields_info = [ - ['COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80], - ['COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40], + [ + 'COLUMN_NAME' => 'Host', + 'CHARACTER_MAXIMUM_LENGTH' => 80, + ], + [ + 'COLUMN_NAME' => 'User', + 'CHARACTER_MAXIMUM_LENGTH' => 40, + ], ]; $dbi->expects($this->any())->method('isSuperuser') ->will($this->returnValue(true)); @@ -1638,8 +1660,14 @@ class PrivilegesTest extends TestCase ->disableOriginalConstructor() ->getMock(); $fields_info = [ - ['COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80], - ['COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40], + [ + 'COLUMN_NAME' => 'Host', + 'CHARACTER_MAXIMUM_LENGTH' => 80, + ], + [ + 'COLUMN_NAME' => 'User', + 'CHARACTER_MAXIMUM_LENGTH' => 40, + ], ]; $dbi->expects($this->any())->method('fetchResult') ->will($this->returnValue($fields_info)); @@ -1708,7 +1736,10 @@ class PrivilegesTest extends TestCase ); $this->assertContains( Url::getCommon( - ['checkprivsdb' => $db, 'checkprivstable' => $table] + [ + 'checkprivsdb' => $db, + 'checkprivstable' => $table, + ] ), $html ); @@ -1738,11 +1769,21 @@ class PrivilegesTest extends TestCase $privMap = [ "user1" => [ "hostname1" => [ - ['Type' => 'g', 'Grant_priv' => 'Y'], - ['Type' => 'd', 'Db' => "dbname", 'Grant_priv' => 'Y'], - ['Type' => 't', 'Grant_priv' => 'N'], - ] - ] + [ + 'Type' => 'g', + 'Grant_priv' => 'Y', + ], + [ + 'Type' => 'd', + 'Db' => "dbname", + 'Grant_priv' => 'Y', + ], + [ + 'Type' => 't', + 'Grant_priv' => 'N', + ], + ], + ], ]; $html = $this->serverPrivileges->getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db); @@ -1965,8 +2006,14 @@ class PrivilegesTest extends TestCase ->disableOriginalConstructor() ->getMock(); $fields_info = [ - ['COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80], - ['COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40], + [ + 'COLUMN_NAME' => 'Host', + 'CHARACTER_MAXIMUM_LENGTH' => 80, + ], + [ + 'COLUMN_NAME' => 'User', + 'CHARACTER_MAXIMUM_LENGTH' => 40, + ], ]; $dbi->expects($this->any())->method('fetchResult') ->will($this->returnValue($fields_info)); @@ -2085,7 +2132,7 @@ class PrivilegesTest extends TestCase $item = Url::getCommon( [ 'db' => $url_dbname, - 'reload' => 1 + 'reload' => 1, ] ); $this->assertContains( @@ -2501,7 +2548,11 @@ class PrivilegesTest extends TestCase // Test case 2 $GLOBALS['dblist'] = new \stdClass(); - $GLOBALS['dblist']->databases = ['x', 'y', 'z']; + $GLOBALS['dblist']->databases = [ + 'x', + 'y', + 'z', + ]; $actual = $this->serverPrivileges->getHtmlForAllTableSpecificRights('pma2', 'host2', 'database', ''); $this->assertContains( '<legend data-submenu-label="Database">', @@ -2560,7 +2611,7 @@ class PrivilegesTest extends TestCase $this->onConsecutiveCalls( [ 'User' => 'pmauser', - 'Host' => 'local' + 'Host' => 'local', ] ) ); @@ -2580,8 +2631,8 @@ class PrivilegesTest extends TestCase 'Password' => '?', 'Grant_priv' => 'N', 'privs' => ['USAGE'] - ] - ] + ], + ], ]; $actual = $this->serverPrivileges->getDbRightsForUserOverview(); $this->assertEquals($expected, $actual); @@ -2607,12 +2658,12 @@ class PrivilegesTest extends TestCase $plugins = [ [ 'PLUGIN_NAME' => 'mysql_native_password', - 'PLUGIN_DESCRIPTION' => 'Native MySQL authentication' + 'PLUGIN_DESCRIPTION' => 'Native MySQL authentication', ], [ 'PLUGIN_NAME' => 'sha256_password', - 'PLUGIN_DESCRIPTION' => 'SHA256 password authentication' - ] + 'PLUGIN_DESCRIPTION' => 'SHA256 password authentication', + ], ]; $dbi->expects($this->any()) ->method('fetchAssoc') diff --git a/test/classes/Server/Status/AdvisorTest.php b/test/classes/Server/Status/AdvisorTest.php index 114653e42e..b5c85b1dfe 100644 --- a/test/classes/Server/Status/AdvisorTest.php +++ b/test/classes/Server/Status/AdvisorTest.php @@ -93,7 +93,7 @@ class AdvisorTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], [ "SHOW GLOBAL VARIABLES", @@ -101,7 +101,7 @@ class AdvisorTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_variables + $server_variables, ], [ "SELECT concat('Com_', variable_name), variable_value " @@ -110,7 +110,7 @@ class AdvisorTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], ]; diff --git a/test/classes/Server/Status/DataTest.php b/test/classes/Server/Status/DataTest.php index 9688b73f5d..6e8043c953 100644 --- a/test/classes/Server/Status/DataTest.php +++ b/test/classes/Server/Status/DataTest.php @@ -77,7 +77,7 @@ class DataTest extends PmaTestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], [ "SHOW GLOBAL VARIABLES", @@ -85,7 +85,7 @@ class DataTest extends PmaTestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_variables + $server_variables, ], [ "SELECT concat('Com_', variable_name), variable_value " @@ -94,7 +94,7 @@ class DataTest extends PmaTestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], ]; diff --git a/test/classes/Server/Status/MonitorTest.php b/test/classes/Server/Status/MonitorTest.php index 5e835fe731..37ff8559de 100644 --- a/test/classes/Server/Status/MonitorTest.php +++ b/test/classes/Server/Status/MonitorTest.php @@ -87,7 +87,7 @@ class MonitorTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], [ "SHOW GLOBAL VARIABLES", @@ -95,7 +95,7 @@ class MonitorTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_variables + $server_variables, ], [ "SELECT concat('Com_', variable_name), variable_value " @@ -104,7 +104,7 @@ class MonitorTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], ]; @@ -259,10 +259,20 @@ class MonitorTest extends TestCase $ret = $this->statusMonitor->getJsonForLogDataTypeSlow($start, $end); $result_rows = [ - ['sql_text' => 'insert sql_text', '#' => 11], - ['sql_text' => 'update sql_text', '#' => 10] + [ + 'sql_text' => 'insert sql_text', + '#' => 11 + ], + [ + 'sql_text' => 'update sql_text', + '#' => 10 + ], + ]; + $result_sum = [ + 'insert' => 11, + 'TOTAL' => 21, + 'update' => 10, ]; - $result_sum = ['insert' => 11, 'TOTAL' => 21, 'update' => 10]; $this->assertEquals( 2, $ret['numRows'] @@ -321,7 +331,11 @@ class MonitorTest extends TestCase $value, $value2, ]; - $result_sum = ['argument' => 10, 'TOTAL' => 21, 'argument3' => 11]; + $result_sum = [ + 'argument' => 10, + 'TOTAL' => 21, + 'argument3' => 11, + ]; $this->assertEquals( 2, diff --git a/test/classes/Server/Status/QueriesTest.php b/test/classes/Server/Status/QueriesTest.php index 4d93bb1385..13fc548f97 100644 --- a/test/classes/Server/Status/QueriesTest.php +++ b/test/classes/Server/Status/QueriesTest.php @@ -88,7 +88,7 @@ class QueriesTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], [ "SHOW GLOBAL VARIABLES", @@ -96,8 +96,8 @@ class QueriesTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_variables - ] + $server_variables, + ], ]; $dbi->expects($this->any())->method('fetchResult') diff --git a/test/classes/Server/Status/VariablesTest.php b/test/classes/Server/Status/VariablesTest.php index 164061245d..7ae553c589 100644 --- a/test/classes/Server/Status/VariablesTest.php +++ b/test/classes/Server/Status/VariablesTest.php @@ -85,7 +85,7 @@ class VariablesTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], [ "SHOW GLOBAL VARIABLES", @@ -93,7 +93,7 @@ class VariablesTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_variables + $server_variables, ], [ "SELECT concat('Com_', variable_name), variable_value " @@ -102,7 +102,7 @@ class VariablesTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], ]; diff --git a/test/classes/Server/StatusTest.php b/test/classes/Server/StatusTest.php index 976ae8f735..5b612e17cf 100644 --- a/test/classes/Server/StatusTest.php +++ b/test/classes/Server/StatusTest.php @@ -82,7 +82,7 @@ class StatusTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], [ "SHOW GLOBAL VARIABLES", @@ -90,7 +90,7 @@ class StatusTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_variables + $server_variables, ], [ "SELECT concat('Com_', variable_name), variable_value " @@ -99,7 +99,7 @@ class StatusTest extends TestCase 1, DatabaseInterface::CONNECT_USER, 0, - $server_status + $server_status, ], ]; diff --git a/test/classes/Server/UserGroupsTest.php b/test/classes/Server/UserGroupsTest.php index 9659924fca..64202489d0 100644 --- a/test/classes/Server/UserGroupsTest.php +++ b/test/classes/Server/UserGroupsTest.php @@ -128,7 +128,8 @@ class UserGroupsTest extends TestCase $url_tag = '<a class="" href="server_user_groups.php" data-post="' . Url::getCommon( [ - 'viewUsers' => 1, 'userGroup' => htmlspecialchars('usergroup') + 'viewUsers' => 1, + 'userGroup' => htmlspecialchars('usergroup'), ], '' ); diff --git a/test/classes/Setup/ConfigGeneratorTest.php b/test/classes/Setup/ConfigGeneratorTest.php index 4d093795a9..b23cc6f818 100644 --- a/test/classes/Setup/ConfigGeneratorTest.php +++ b/test/classes/Setup/ConfigGeneratorTest.php @@ -35,9 +35,17 @@ class ConfigGeneratorTest extends PmaTestCase $GLOBALS['server'] = 0; $cf = new ConfigFile(); - $_SESSION['ConfigFile0'] = ['a', 'b', 'c']; + $_SESSION['ConfigFile0'] = [ + 'a', + 'b', + 'c', + ]; $_SESSION['ConfigFile0']['Servers'] = [ - [1, 2, 3] + [ + 1, + 2, + 3, + ], ]; $cf->setPersistKeys(["1/", 2]); @@ -98,7 +106,11 @@ class ConfigGeneratorTest extends PmaTestCase $method->invoke( null, 'var_name', - [1, 2, 3], + [ + 1, + 2, + 3, + ], "\n" ) ); @@ -134,7 +146,7 @@ class ConfigGeneratorTest extends PmaTestCase null, [ 'a' => 1, - 'b' => 2 + 'b' => 2, ] ) ); @@ -160,7 +172,11 @@ class ConfigGeneratorTest extends PmaTestCase $this->assertTrue( $method->invoke( null, - [1, 2, 3] + [ + 1, + 2, + 3, + ] ) ); } @@ -176,7 +192,12 @@ class ConfigGeneratorTest extends PmaTestCase $method = $reflection->getMethod('_exportZeroBasedArray'); $method->setAccessible(true); - $arr = [1, 2, 3, 4]; + $arr = [ + 1, + 2, + 3, + 4, + ]; $result = $method->invoke(null, $arr, "\n"); @@ -185,7 +206,14 @@ class ConfigGeneratorTest extends PmaTestCase $result ); - $arr = [1, 2, 3, 4, 7, 'foo']; + $arr = [ + 1, + 2, + 3, + 4, + 7, + 'foo', + ]; $result = $method->invoke(null, $arr, "\n"); diff --git a/test/classes/Setup/FormProcessingTest.php b/test/classes/Setup/FormProcessingTest.php index 57b7dc1dcc..f61cc43045 100644 --- a/test/classes/Setup/FormProcessingTest.php +++ b/test/classes/Setup/FormProcessingTest.php @@ -44,7 +44,7 @@ class FormProcessingTest extends PmaTestCase [ ['status: 303 See Other'], ['Location: index.php?lang=en'], - 303 + 303, ] ); diff --git a/test/classes/Setup/IndexTest.php b/test/classes/Setup/IndexTest.php index a9d470a130..99d571a1fe 100644 --- a/test/classes/Setup/IndexTest.php +++ b/test/classes/Setup/IndexTest.php @@ -39,8 +39,8 @@ class IndexTest extends TestCase $_SESSION['messages'] = [ [ ['foo'], - ['bar'] - ] + ['bar'], + ], ]; SetupIndex::messagesBegin(); @@ -51,14 +51,14 @@ class IndexTest extends TestCase [ 0 => 'foo', 'fresh' => false, - 'active' => false + 'active' => false, ], [ 0 => 'bar', 'fresh' => false, - 'active' => false - ] - ] + 'active' => false, + ], + ], ], $_SESSION['messages'] ); @@ -70,7 +70,7 @@ class IndexTest extends TestCase $this->assertEquals( [ 'error' => [], - 'notice' => [] + 'notice' => [], ], $_SESSION['messages'] ); @@ -90,7 +90,7 @@ class IndexTest extends TestCase 'fresh' => true, 'active' => true, 'title' => 'testTitle', - 'message' => 'msg' + 'message' => 'msg', ], $_SESSION['messages']['type']['123'] ); @@ -105,9 +105,15 @@ class IndexTest extends TestCase { $_SESSION['messages'] = [ [ - ['msg' => 'foo', 'active' => false], - ['msg' => 'bar', 'active' => true], - ] + [ + 'msg' => 'foo', + 'active' => false, + ], + [ + 'msg' => 'bar', + 'active' => true, + ], + ], ]; SetupIndex::messagesEnd(); @@ -117,9 +123,9 @@ class IndexTest extends TestCase [ '1' => [ 'msg' => 'bar', - 'active' => 1 - ] - ] + 'active' => 1, + ], + ], ], $_SESSION['messages'] ); @@ -134,9 +140,17 @@ class IndexTest extends TestCase { $_SESSION['messages'] = [ 'type' => [ - ['title' => 'foo', 'message' => '123', 'fresh' => false], - ['title' => 'bar', 'message' => '321', 'fresh' => true], - ] + [ + 'title' => 'foo', + 'message' => '123', + 'fresh' => false + ], + [ + 'title' => 'bar', + 'message' => '321', + 'fresh' => true + ], + ], ]; ob_start(); diff --git a/test/classes/SqlQueryFormTest.php b/test/classes/SqlQueryFormTest.php index 2899345ab2..a291b91828 100644 --- a/test/classes/SqlQueryFormTest.php +++ b/test/classes/SqlQueryFormTest.php @@ -87,7 +87,10 @@ class SqlQueryFormTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $fetchResult = ["index1" => "table1", "index2" => "table2"]; + $fetchResult = [ + "index1" => "table1", + "index2" => "table2", + ]; $dbi->expects($this->any()) ->method('fetchResult') ->will($this->returnValue($fetchResult)); @@ -95,8 +98,8 @@ class SqlQueryFormTest extends TestCase $getColumns = [ [ "Field" => "field1", - "Comment" => "Comment1" - ] + "Comment" => "Comment1", + ], ]; $dbi->expects($this->any()) ->method('getColumns') diff --git a/test/classes/SqlTest.php b/test/classes/SqlTest.php index 01d6474a0f..462806c57a 100644 --- a/test/classes/SqlTest.php +++ b/test/classes/SqlTest.php @@ -258,18 +258,30 @@ class SqlTest extends TestCase $col3 = new stdClass(); $col3->table = 'table3'; - $fields_meta = [$col1, $col2, $col3]; + $fields_meta = [ + $col1, + $col2, + $col3, + ]; $this->assertFalse( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) ); // should not matter on where the odd column occurs - $fields_meta = [$col2, $col3, $col1]; + $fields_meta = [ + $col2, + $col3, + $col1, + ]; $this->assertFalse( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) ); - $fields_meta = [$col3, $col1, $col2]; + $fields_meta = [ + $col3, + $col1, + $col2, + ]; $this->assertFalse( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) ); @@ -288,7 +300,11 @@ class SqlTest extends TestCase $col2->table = 'table1'; $col3 = new stdClass(); $col3->table = 'table1'; - $fields_meta = [$col1, $col2, $col3]; + $fields_meta = [ + $col1, + $col2, + $col3, + ]; $this->assertTrue( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) @@ -310,18 +326,30 @@ class SqlTest extends TestCase $col3 = new stdClass(); $col3->table = 'table1'; - $fields_meta = [$col1, $col2, $col3]; + $fields_meta = [ + $col1, + $col2, + $col3, + ]; $this->assertTrue( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) ); // should not matter on where the function column occurs - $fields_meta = [$col2, $col3, $col1]; + $fields_meta = [ + $col2, + $col3, + $col1, + ]; $this->assertTrue( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) ); - $fields_meta = [$col3, $col1, $col2]; + $fields_meta = [ + $col3, + $col1, + $col2, + ]; $this->assertTrue( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) ); @@ -341,7 +369,11 @@ class SqlTest extends TestCase $col2->table = ''; $col3 = new stdClass(); $col3->table = ''; - $fields_meta = [$col1, $col2, $col3]; + $fields_meta = [ + $col1, + $col2, + $col3, + ]; $this->assertFalse( $this->callProtectedMethod('resultSetHasJustOneTable', [$fields_meta]) diff --git a/test/classes/StorageEngineTest.php b/test/classes/StorageEngineTest.php index cafd6ec94f..4360ac5a69 100644 --- a/test/classes/StorageEngineTest.php +++ b/test/classes/StorageEngineTest.php @@ -74,7 +74,7 @@ class StorageEngineTest extends PmaTestCase 'FEDERATED' => [ 'Engine' => 'FEDERATED', 'Support' => 'NO', - 'Comment' => 'Federated MySQL storage engine' + 'Comment' => 'Federated MySQL storage engine', ], ], $this->object->getStorageEngines() @@ -124,19 +124,58 @@ class StorageEngineTest extends PmaTestCase public function providerGetEngine() { return [ - ['PhpMyAdmin\StorageEngine', 'unknown engine'], - ['PhpMyAdmin\Engines\Bdb', 'Bdb'], - ['PhpMyAdmin\Engines\Berkeleydb', 'Berkeleydb'], - ['PhpMyAdmin\Engines\Binlog', 'Binlog'], - ['PhpMyAdmin\Engines\Innobase', 'Innobase'], - ['PhpMyAdmin\Engines\Innodb', 'Innodb'], - ['PhpMyAdmin\Engines\Memory', 'Memory'], - ['PhpMyAdmin\Engines\Merge', 'Merge'], - ['PhpMyAdmin\Engines\MrgMyisam', 'Mrg_Myisam'], - ['PhpMyAdmin\Engines\Myisam', 'Myisam'], - ['PhpMyAdmin\Engines\Ndbcluster', 'Ndbcluster'], - ['PhpMyAdmin\Engines\Pbxt', 'Pbxt'], - ['PhpMyAdmin\Engines\PerformanceSchema', 'Performance_Schema'], + [ + 'PhpMyAdmin\StorageEngine', + 'unknown engine', + ], + [ + 'PhpMyAdmin\Engines\Bdb', + 'Bdb', + ], + [ + 'PhpMyAdmin\Engines\Berkeleydb', + 'Berkeleydb', + ], + [ + 'PhpMyAdmin\Engines\Binlog', + 'Binlog', + ], + [ + 'PhpMyAdmin\Engines\Innobase', + 'Innobase', + ], + [ + 'PhpMyAdmin\Engines\Innodb', + 'Innodb', + ], + [ + 'PhpMyAdmin\Engines\Memory', + 'Memory', + ], + [ + 'PhpMyAdmin\Engines\Merge', + 'Merge', + ], + [ + 'PhpMyAdmin\Engines\MrgMyisam', + 'Mrg_Myisam', + ], + [ + 'PhpMyAdmin\Engines\Myisam', + 'Myisam', + ], + [ + 'PhpMyAdmin\Engines\Ndbcluster', + 'Ndbcluster', + ], + [ + 'PhpMyAdmin\Engines\Pbxt', + 'Pbxt', + ], + [ + 'PhpMyAdmin\Engines\PerformanceSchema', + 'Performance_Schema', + ], ]; } @@ -302,7 +341,7 @@ class StorageEngineTest extends PmaTestCase $this->assertEquals( [ 0 => 12, - 1 => 'B' + 1 => 'B', ], $this->object->resolveTypeSize(12) ); diff --git a/test/classes/SysInfoTest.php b/test/classes/SysInfoTest.php index c7ddfb6e4c..0b609648c5 100644 --- a/test/classes/SysInfoTest.php +++ b/test/classes/SysInfoTest.php @@ -45,10 +45,22 @@ class SysInfoTest extends TestCase public function sysInfoOsProvider() { return [ - ['FreeBSD', 'Linux'], - ['Linux', 'Linux'], - ['Winnt', 'Winnt'], - ['SunOS', 'SunOS'], + [ + 'FreeBSD', + 'Linux', + ], + [ + 'Linux', + 'Linux', + ], + [ + 'Winnt', + 'Winnt', + ], + [ + 'SunOS', + 'SunOS', + ], ]; } diff --git a/test/classes/SystemDatabaseTest.php b/test/classes/SystemDatabaseTest.php index 32265ad061..79cdcac8ac 100644 --- a/test/classes/SystemDatabaseTest.php +++ b/test/classes/SystemDatabaseTest.php @@ -111,8 +111,8 @@ class SystemDatabaseTest extends PmaTestCase $column_map = [ [ "table_name" => "table_name", - "refering_column" => "column_name" - ] + "refering_column" => "column_name", + ], ]; $view_name = "view_name"; diff --git a/test/classes/TableTest.php b/test/classes/TableTest.php index e18cf69c43..8b2898af62 100644 --- a/test/classes/TableTest.php +++ b/test/classes/TableTest.php @@ -100,7 +100,7 @@ class TableTest extends PmaTestCase null, DatabaseInterface::CONNECT_USER, 0, - true + true, ], [ $sql_copy_data, @@ -108,7 +108,7 @@ class TableTest extends PmaTestCase null, DatabaseInterface::CONNECT_USER, 0, - false + false, ], [ $sql_isView_false, @@ -116,7 +116,7 @@ class TableTest extends PmaTestCase null, DatabaseInterface::CONNECT_USER, 0, - false + false, ], [ $sql_isUpdatableView_true, @@ -124,7 +124,7 @@ class TableTest extends PmaTestCase null, DatabaseInterface::CONNECT_USER, 0, - true + true, ], [ $sql_isUpdatableView_false, @@ -132,7 +132,7 @@ class TableTest extends PmaTestCase null, DatabaseInterface::CONNECT_USER, 0, - false + false, ], [ $sql_analyzeStructure_true, @@ -141,12 +141,18 @@ class TableTest extends PmaTestCase DatabaseInterface::CONNECT_USER, 0, [ - ['COLUMN_NAME' => 'COLUMN_NAME', 'DATA_TYPE' => 'DATA_TYPE'] - ] + [ + 'COLUMN_NAME' => 'COLUMN_NAME', + 'DATA_TYPE' => 'DATA_TYPE' + ], + ], ], [ $getUniqueColumns_sql, - ['Key_name', null], + [ + 'Key_name', + null, + ], 'Column_name', DatabaseInterface::CONNECT_USER, 0, @@ -154,7 +160,7 @@ class TableTest extends PmaTestCase ['index1'], ['index3'], ['index5'], - ] + ], ], [ $getUniqueColumns_sql, @@ -168,8 +174,8 @@ class TableTest extends PmaTestCase 'column5', 'ACCESSIBLE', 'ADD', - 'ALL' - ] + 'ALL', + ], ], [ 'SHOW COLUMNS FROM `PMA`.`PMA_BookMark`', @@ -183,8 +189,8 @@ class TableTest extends PmaTestCase 'column5', 'ACCESSIBLE', 'ADD', - 'ALL' - ] + 'ALL', + ], ], [ 'SHOW COLUMNS FROM `PMA`.`PMA_BookMark`', @@ -208,8 +214,8 @@ class TableTest extends PmaTestCase 'Key' => '', 'Default' => null, 'Extra' => 'STORED GENERATED' - ] - ] + ], + ], ], ]; @@ -259,9 +265,18 @@ class TableTest extends PmaTestCase ->will($this->returnValue(10)); $triggers = [ - ["name" => "name1", "create" => "crate1"], - ["name" => "name2", "create" => "crate2"], - ["name" => "name3", "create" => "crate3"], + [ + "name" => "name1", + "create" => "crate1", + ], + [ + "name" => "name2", + "create" => "crate2", + ], + [ + "name" => "name3", + "create" => "crate3", + ], ]; $dbi->expects($this->any())->method('getTriggers') @@ -411,16 +426,49 @@ class TableTest extends PmaTestCase public function dataValidateName() { return [ - ['test', true], - ['te/st', false], - ['te.st', false], - ['te\\st', false], - ['te st', false], - [' te st', true, true], - ['test ', false], - ['te.st', false], - ['test ', false, true], - ['te.st ', false, true], + [ + 'test', + true, + ], + [ + 'te/st', + false, + ], + [ + 'te.st', + false, + ], + [ + 'te\\st', + false, + ], + [ + 'te st', + false, + ], + [ + ' te st', + true, + true, + ], + [ + 'test ', + false, + ], + [ + 'te.st', + false, + ], + [ + 'test ', + false, + true, + ], + [ + 'te.st ', + false, + true, + ], ]; } @@ -672,9 +720,18 @@ class TableTest extends PmaTestCase { $work = "PMA_work"; $pma_table = "pma_table"; - $get_fields = ["filed0", "field6"]; - $where_fields = ["field2", "filed5"]; - $new_fields = ["field3", "filed4"]; + $get_fields = [ + "filed0", + "field6", + ]; + $where_fields = [ + "field2", + "filed5", + ]; + $new_fields = [ + "field3", + "filed4", + ]; $GLOBALS['cfgRelation'][$work] = true; $GLOBALS['cfgRelation']['db'] = "PMA_db"; $GLOBALS['cfgRelation'][$pma_table] = "pma_table"; @@ -749,8 +806,21 @@ class TableTest extends PmaTestCase public function testIsMergeCase2() { $map = [ - [['PMA', 'PMA_BookMark'], null, ['ENGINE' => "MERGE"]], - [['PMA', 'PMA_BookMark', 'ENGINE'], null, "MERGE"] + [ + [ + 'PMA', + 'PMA_BookMark', + ], null, + ['ENGINE' => "MERGE"], + ], + [ + [ + 'PMA', + 'PMA_BookMark', + 'ENGINE', + ], null, + "MERGE", + ], ]; $GLOBALS['dbi']->expects($this->any()) ->method('getCachedTableContent') @@ -771,8 +841,21 @@ class TableTest extends PmaTestCase public function testIsMergeCase3() { $map = [ - [['PMA', 'PMA_BookMark'], null, ['ENGINE' => "MRG_MYISAM"]], - [['PMA', 'PMA_BookMark', 'ENGINE'], null, "MRG_MYISAM"] + [ + [ + 'PMA', + 'PMA_BookMark', + ], null, + ['ENGINE' => "MRG_MYISAM"], + ], + [ + [ + 'PMA', + 'PMA_BookMark', + 'ENGINE', + ], null, + "MRG_MYISAM", + ], ]; $GLOBALS['dbi']->expects($this->any()) ->method('getCachedTableContent') @@ -793,8 +876,21 @@ class TableTest extends PmaTestCase public function testIsMergeCase4() { $map = [ - [['PMA', 'PMA_BookMark'], null, ['ENGINE' => "ISDB"]], - [['PMA', 'PMA_BookMark', 'ENGINE'], null, "ISDB"] + [ + [ + 'PMA', + 'PMA_BookMark', + ], null, + ['ENGINE' => "ISDB"], + ], + [ + [ + 'PMA', + 'PMA_BookMark', + 'ENGINE', + ], null, + "ISDB", + ], ]; $GLOBALS['dbi']->expects($this->any()) ->method('getCachedTableContent') @@ -936,7 +1032,7 @@ class TableTest extends PmaTestCase $expect = [ '`PMA`.`PMA_BookMark`.`index1`', '`PMA`.`PMA_BookMark`.`index3`', - '`PMA`.`PMA_BookMark`.`index5`' + '`PMA`.`PMA_BookMark`.`index5`', ]; $this->assertEquals( $expect, @@ -1010,10 +1106,16 @@ class TableTest extends PmaTestCase public function testGetSQLToCreateForeignKey() { $table = "PMA_table"; - $field = ["PMA_field1", "PMA_field2"]; + $field = [ + "PMA_field1", + "PMA_field2", + ]; $foreignDb = "foreignDb"; $foreignTable = "foreignTable"; - $foreignField = ["foreignField1", "foreignField2"]; + $foreignField = [ + "foreignField1", + "foreignField2", + ]; $class = new ReflectionClass(Table::class); $method = $class->getMethod('_getSQLToCreateForeignKey'); @@ -1027,7 +1129,7 @@ class TableTest extends PmaTestCase $field, $foreignDb, $foreignTable, - $foreignField + $foreignField, ] ); $sql_excepted = 'ALTER TABLE `PMA_table` ADD ' @@ -1046,7 +1148,7 @@ class TableTest extends PmaTestCase $field, 'db', $foreignTable, - $foreignField + $foreignField, ] ); $sql_excepted = 'ALTER TABLE `PMA_table` ADD ' @@ -1145,7 +1247,10 @@ class TableTest extends PmaTestCase ->willReturnOnConsecutiveCalls( [['`one_pk`']], [], // No Uniques found - ['`one_ind`', '`sec_ind`'], + [ + '`one_ind`', + '`sec_ind`', + ], [], // No Uniques found [] // No Indexed found ); @@ -1192,11 +1297,24 @@ class TableTest extends PmaTestCase { $map = [ [ - ['PMA', 'PMA_BookMark'], + [ + 'PMA', + 'PMA_BookMark', + ], null, - ['Comment' => "Comment222", 'TABLE_TYPE' => "VIEW"], + [ + 'Comment' => "Comment222", + 'TABLE_TYPE' => "VIEW", + ], + ], + [ + [ + 'PMA', + 'PMA_BookMark', + 'TABLE_TYPE', + ], null, + 'VIEW', ], - [['PMA', 'PMA_BookMark', 'TABLE_TYPE'], null, 'VIEW'], ]; $GLOBALS['dbi']->expects($this->any()) ->method('getCachedTableContent') @@ -1465,7 +1583,10 @@ class TableTest extends PmaTestCase $dbi = new DatabaseInterface($extension); $tbl_object = new Table($target_db, $target_table, $dbi); $tbl_object->getStatusInfo(null, true); - $expect = ['pack_keys' => 'DEFAULT', 'row_format' => 'REDUNDANT']; + $expect = [ + 'pack_keys' => 'DEFAULT', + 'row_format' => 'REDUNDANT', + ]; $create_options = $dbi->getTable( $target_db, $target_table diff --git a/test/classes/TemplateTest.php b/test/classes/TemplateTest.php index 0bb3380cfc..27cb802408 100644 --- a/test/classes/TemplateTest.php +++ b/test/classes/TemplateTest.php @@ -93,7 +93,11 @@ class TemplateTest extends PmaTestCase public function providerTestDynamicRender() { return [ - ['test/echo', 'variable', 'value'], + [ + 'test/echo', + 'variable', + 'value', + ], ]; } @@ -134,7 +138,10 @@ class TemplateTest extends PmaTestCase public function providerTestRender() { return [ - ['test/static', 'static content'], + [ + 'test/static', + 'static content', + ], ]; } @@ -165,13 +172,41 @@ class TemplateTest extends PmaTestCase public function providerTestRenderGettext() { return [ - ['test/gettext/gettext', [], 'Text'], - ['test/gettext/pgettext', [], 'Text'], - ['test/gettext/notes', [], 'Text'], - ['test/gettext/plural', ['table_count' => 1], 'One table'], - ['test/gettext/plural', ['table_count' => 2], '2 tables'], - ['test/gettext/plural_notes', ['table_count' => 1], 'One table'], - ['test/gettext/plural_notes', ['table_count' => 2], '2 tables'], + [ + 'test/gettext/gettext', + [], + 'Text', + ], + [ + 'test/gettext/pgettext', + [], + 'Text', + ], + [ + 'test/gettext/notes', + [], + 'Text', + ], + [ + 'test/gettext/plural', + ['table_count' => 1], + 'One table', + ], + [ + 'test/gettext/plural', + ['table_count' => 2], + '2 tables', + ], + [ + 'test/gettext/plural_notes', + ['table_count' => 1], + 'One table', + ], + [ + 'test/gettext/plural_notes', + ['table_count' => 2], + '2 tables', + ], ]; } } diff --git a/test/classes/ThemeTest.php b/test/classes/ThemeTest.php index 5f5952f3ed..fe121627d6 100644 --- a/test/classes/ThemeTest.php +++ b/test/classes/ThemeTest.php @@ -290,22 +290,22 @@ class ThemeTest extends PmaTestCase [ null, null, - '' + '', ], [ 'screen.png', null, - './themes/pmahomme/img/screen.png' + './themes/pmahomme/img/screen.png', ], [ 'arrow_ltr.png', null, - './themes/pmahomme/img/arrow_ltr.png' + './themes/pmahomme/img/arrow_ltr.png', ], [ 'logo_right.png', 'pma_logo.png', - './themes/pmahomme/img/pma_logo.png' + './themes/pmahomme/img/pma_logo.png', ], ]; } diff --git a/test/classes/TrackerTest.php b/test/classes/TrackerTest.php index 4bd0a3f236..e53390a1da 100644 --- a/test/classes/TrackerTest.php +++ b/test/classes/TrackerTest.php @@ -90,7 +90,7 @@ class TrackerTest extends PmaTestCase $_SESSION['relation'][$GLOBALS['server']] = [ 'PMA_VERSION' => PMA_VERSION, - 'trackingwork' => false + 'trackingwork' => false, ]; $this->assertFalse( @@ -140,9 +140,18 @@ class TrackerTest extends PmaTestCase public function getTableNameData() { return [ - ["`tbl`;", "tbl"], - [" `pma.table` ", "table"], - [" `pma.table\nfoobar` ", "table"] + [ + "`tbl`;", + "tbl", + ], + [ + " `pma.table` ", + "table", + ], + [ + " `pma.table\nfoobar` ", + "table", + ], ]; } @@ -231,7 +240,7 @@ class TrackerTest extends PmaTestCase 'Field' => 'field2', 'Type' => 'text', 'Key' => '' - ] + ], ]; $dbi->expects($this->once())->method('getColumns') ->with('pma_test', 'pma_tbl') @@ -242,7 +251,7 @@ class TrackerTest extends PmaTestCase 'Table' => 'pma_tbl', 'Field' => 'field1', 'Key' => 'PRIMARY' - ] + ], ]; $dbi->expects($this->once())->method('getTableIndexes') ->with('pma_test', 'pma_tbl') @@ -294,8 +303,8 @@ class TrackerTest extends PmaTestCase DatabaseInterface::CONNECT_CONTROL, 0, false, - 'executed' - ] + 'executed', + ], ]; $dbi->expects($this->any())->method('query') @@ -485,12 +494,12 @@ class TrackerTest extends PmaTestCase $new_data = [ [ 'username' => 'user1', - 'statement' => 'test_statement1' + 'statement' => 'test_statement1', ], [ 'username' => 'user2', - 'statement' => 'test_statement2' - ] + 'statement' => 'test_statement2', + ], ]; $sql_query_2 = " UPDATE `pmadb`.`tracking`" . @@ -504,8 +513,20 @@ class TrackerTest extends PmaTestCase ->will( $this->returnValueMap( [ - [$sql_query_1, DatabaseInterface::CONNECT_CONTROL, 0, false, "executed_1"], - [$sql_query_2, DatabaseInterface::CONNECT_CONTROL, 0, false, "executed_2"] + [ + $sql_query_1, + DatabaseInterface::CONNECT_CONTROL, + 0, + false, + "executed_1", + ], + [ + $sql_query_2, + DatabaseInterface::CONNECT_CONTROL, + 0, + false, + "executed_2", + ], ] ) ); @@ -590,9 +611,18 @@ class TrackerTest extends PmaTestCase ->will( $this->returnValueMap( [ - ["pma'db", "pma\'db"], - ["pma'table", "pma\'table"], - ["1.0", "1.0"], + [ + "pma'db", + "pma\'db", + ], + [ + "pma'table", + "pma\'table", + ], + [ + "1.0", + "1.0", + ], ] ) ); @@ -620,7 +650,7 @@ class TrackerTest extends PmaTestCase "data_sql" => "# log ", "schema_snapshot" => "dataschema", "tracking" => "SELECT, DELETE" - ] + ], ]; $data = [ @@ -631,18 +661,18 @@ class TrackerTest extends PmaTestCase [ 'date' => '20-03-2013 23:33:58', 'username' => 'user1', - 'statement' => "\nstat1" + 'statement' => "\nstat1", ], [ 'date' => '20-03-2013 23:39:58', 'username' => 'user2', - 'statement' => "" - ] + 'statement' => "", + ], ], 'dmlog' => [], "schema_snapshot" => "dataschema", "tracking" => "SELECT, DELETE" - ] + ], ]; $fetchArrayReturn[1] = [ @@ -661,32 +691,38 @@ class TrackerTest extends PmaTestCase [ 'date' => '20-03-2012 23:33:58', 'username' => 'user1', - 'statement' => "" + 'statement' => "", ], [ 'date' => '20-03-2012 23:39:58', 'username' => 'user2', - 'statement' => "" - ] + 'statement' => "", + ], ], 'dmlog' => [ [ 'date' => '20-03-2013 23:33:58', 'username' => 'user3', - 'statement' => "" + 'statement' => "", ], [ 'date' => '20-03-2013 23:39:58', 'username' => 'user4', - 'statement' => "" - ] + 'statement' => "", + ], ], "schema_snapshot" => "dataschema", "tracking" => "SELECT, DELETE" ]; return [ - [$fetchArrayReturn[0], $data[0]], - [$fetchArrayReturn[1], $data[1]] + [ + $fetchArrayReturn[0], + $data[0], + ], + [ + $fetchArrayReturn[1], + $data[1], + ], ]; } @@ -772,87 +808,87 @@ class TrackerTest extends PmaTestCase "ALTER VIEW db1.v AS SELECT col1, col2, col3, col4 FROM t", "DDL", "ALTER VIEW", - "v" + "v", ]; $query[] = [ "DROP VIEW db1.v;", "DDL", "DROP VIEW", - "v" + "v", ]; $query[] = [ "DROP VIEW IF EXISTS db1.v;", "DDL", "DROP VIEW", - "v" + "v", ]; $query[] = [ "CREATE DATABASE db1;", "DDL", "CREATE DATABASE", "", - "db1" + "db1", ]; $query[] = [ "ALTER DATABASE db1;", "DDL", "ALTER DATABASE", - "" + "", ]; $query[] = [ "DROP DATABASE db1;", "DDL", "DROP DATABASE", "", - "db1" + "db1", ]; $query[] = [ "CREATE TABLE db1.t1 (c1 INT);", "DDL", "CREATE TABLE", - "t1" + "t1", ]; $query[] = [ "ALTER TABLE db1.t1 ADD c2 TEXT;", "DDL", "ALTER TABLE", - "t1" + "t1", ]; $query[] = [ "DROP TABLE db1.t1", "DDL", "DROP TABLE", - "t1" + "t1", ]; $query[] = [ "DROP TABLE IF EXISTS db1.t1", "DDL", "DROP TABLE", - "t1" + "t1", ]; $query[] = [ "CREATE INDEX ind ON db1.t1 (c2(10));", "DDL", "CREATE INDEX", - "t1" + "t1", ]; $query[] = [ "CREATE UNIQUE INDEX ind ON db1.t1 (c2(10));", "DDL", "CREATE INDEX", - "t1" + "t1", ]; $query[] = [ "CREATE SPATIAL INDEX ind ON db1.t1 (c2(10));", "DDL", "CREATE INDEX", - "t1" + "t1", ]; $query[] = [ "DROP INDEX ind ON db1.t1;", "DDL", "DROP INDEX", - "t1" + "t1", ]; $query[] = [ "RENAME TABLE db1.t1 TO db1.t2", @@ -860,31 +896,31 @@ class TrackerTest extends PmaTestCase "RENAME TABLE", "t1", "", - "t2" + "t2", ]; $query[] = [ "UPDATE db1.t1 SET a = 2", "DML", "UPDATE", - "t1" + "t1", ]; $query[] = [ "INSERT INTO db1.t1 (a, b, c) VALUES(1, 2, 3)", "DML", "INSERT", - "t1" + "t1", ]; $query[] = [ "DELETE FROM db1.t1", "DML", "DELETE", - "t1" + "t1", ]; $query[] = [ "TRUNCATE db1.t1", "DML", "TRUNCATE", - "t1" + "t1", ]; return $query; diff --git a/test/classes/TrackingTest.php b/test/classes/TrackingTest.php index 19ffdb55a2..aaee63b939 100644 --- a/test/classes/TrackingTest.php +++ b/test/classes/TrackingTest.php @@ -50,7 +50,7 @@ class TrackingTest extends TestCase 'PMA_VERSION' => PMA_VERSION, 'db' => 'pmadb', 'tracking' => 'tracking', - 'trackingwork' => true + 'trackingwork' => true, ]; $GLOBALS['cfg']['Server']['tracking_default_statements'] = 'DELETE'; @@ -85,12 +85,12 @@ class TrackingTest extends TestCase [ "date" => "20120102", "username" => "username1", - "statement" => "statement1" + "statement" => "statement1", ], [ "date" => "20130102", "username" => "username2", - "statement" => "statement2" + "statement" => "statement2", ], ]; $filter_ts_from = 0; @@ -128,16 +128,16 @@ class TrackingTest extends TestCase "lovely_" => [ "is_group" => 1, "hello_lovely_world" => [ - "Name" => "hello_lovely_world" + "Name" => "hello_lovely_world", ], "hello_lovely_world2" => [ - "Name" => "hello_lovely_world2" - ] + "Name" => "hello_lovely_world2", + ], ], "hello_world" => [ - "Name" => "hello_world" - ] - ] + "Name" => "hello_world", + ], + ], ]; $untracked_tables = $this->tracking->extractTableNames($table_list, 'db', true); $this->assertContains( @@ -571,7 +571,7 @@ class TrackingTest extends TestCase 'statement' => 'statement', 'date' => 'date', 'username' => 'username', - ] + ], ], 'ddlog' => ['ddlog'] ]; @@ -635,7 +635,7 @@ class TrackingTest extends TestCase 'statement' => 'statement', 'date' => 'date', 'username' => 'username', - ] + ], ], 'dmlog' => ['dmlog'] ]; @@ -822,14 +822,14 @@ class TrackingTest extends TestCase 'statement' => 'statement1', 'date' => 'date2', 'username' => 'username3', - ] + ], ], 'dmlog' => [ [ 'statement' => 'statement1', 'date' => 'date2', 'username' => 'username3', - ] + ], ], ]; $filter_users = ["*"]; diff --git a/test/classes/TransformationsTest.php b/test/classes/TransformationsTest.php index 98d542e038..e500d98b11 100644 --- a/test/classes/TransformationsTest.php +++ b/test/classes/TransformationsTest.php @@ -79,11 +79,39 @@ class TransformationsTest extends TestCase public function getOptionsData() { return [ - ["option1 , option2 ", ['option1 ', ' option2 ']], - ["'option1' ,' option2' ", ['option1', ' option2']], - ["'2,3' ,' ,, option ,,' ", ['2,3', ' ,, option ,,']], - ["'',,", ['', '', '']], - ['', []], + [ + "option1 , option2 ", + [ + 'option1 ', + ' option2 ', + ], + ], + [ + "'option1' ,' option2' ", + [ + 'option1', + ' option2', + ], + ], + [ + "'2,3' ,' ,, option ,,' ", + [ + '2,3', + ' ,, option ,,', + ], + ], + [ + "'',,", + [ + '', + '', + '', + ], + ], + [ + '', + [], + ], ]; } @@ -284,23 +312,23 @@ class TransformationsTest extends TestCase return [ [ 'text_plain_bool2text.php', - 'Text_Plain_Bool2Text.php' + 'Text_Plain_Bool2Text.php', ], [ 'application_octetstream_download.php', - 'Application_Octetstream_Download.php' + 'Application_Octetstream_Download.php', ], [ 'text_plain_json.php', - 'Text_Plain_Json.php' + 'Text_Plain_Json.php', ], [ 'image_jpeg_link.php', - 'Image_JPEG_Link.php' + 'Image_JPEG_Link.php', ], [ 'text_plain_dateformat.php', - 'Text_Plain_Dateformat.php' + 'Text_Plain_Dateformat.php', ], ]; } @@ -329,9 +357,18 @@ class TransformationsTest extends TestCase public function providerGetDescription() { return [ - ['../../../../test', ''], - ['Input/Text_Plain_SqlEditor', 'Syntax highlighted CodeMirror editor for SQL.'], - ['Output/Text_Plain_Sql', 'Formats text as SQL query with syntax highlighting.'] + [ + '../../../../test', + '', + ], + [ + 'Input/Text_Plain_SqlEditor', + 'Syntax highlighted CodeMirror editor for SQL.', + ], + [ + 'Output/Text_Plain_Sql', + 'Formats text as SQL query with syntax highlighting.', + ], ]; } @@ -359,9 +396,18 @@ class TransformationsTest extends TestCase public function providerGetName() { return [ - ['../../../../test', ''], - ['Input/Text_Plain_SqlEditor', 'SQL'], - ['Output/Text_Plain_Sql', 'SQL'] + [ + '../../../../test', + '', + ], + [ + 'Input/Text_Plain_SqlEditor', + 'SQL', + ], + [ + 'Output/Text_Plain_Sql', + 'SQL', + ], ]; } } diff --git a/test/classes/TypesTest.php b/test/classes/TypesTest.php index 8721cecc21..99f027aabb 100644 --- a/test/classes/TypesTest.php +++ b/test/classes/TypesTest.php @@ -183,7 +183,7 @@ class TypesTest extends PmaTestCase [ '=', '!=', - ] + ], ], [ 'CHAR', @@ -212,9 +212,9 @@ class TypesTest extends PmaTestCase [ '=', '!=', - ] + ], ], - ] + ], ]; } @@ -255,8 +255,8 @@ class TypesTest extends PmaTestCase false, '=', '<option value="=" selected="selected">=</option>' - . '<option value="!=">!=</option>' - ] + . '<option value="!=">!=</option>', + ], ]; } @@ -403,7 +403,7 @@ class TypesTest extends PmaTestCase 'USER', 'UUID', 'VERSION', - ] + ], ], [ 'DATE', @@ -423,7 +423,7 @@ class TypesTest extends PmaTestCase 'UTC_TIME', 'UTC_TIMESTAMP', 'YEAR', - ] + ], ], [ 'SPATIAL', @@ -446,7 +446,7 @@ class TypesTest extends PmaTestCase 'MPointFromWKB', 'PolyFromWKB', 'MPolyFromWKB', - ] + ], ], [ 'NUMBER', @@ -502,13 +502,13 @@ class TypesTest extends PmaTestCase '48' => 'WEEK', '49' => 'WEEKDAY', '50' => 'WEEKOFYEAR', - '51' => 'YEARWEEK' - ] + '51' => 'YEARWEEK', + ], ], [ 'UNKNOWN', - [] - ] + [], + ], ]; } @@ -796,24 +796,24 @@ class TypesTest extends PmaTestCase return [ [ 'SERIAL', - 'NUMBER' + 'NUMBER', ], [ 'YEAR', - 'DATE' + 'DATE', ], [ 'GEOMETRYCOLLECTION', - 'SPATIAL' + 'SPATIAL', ], [ 'SET', - 'CHAR' + 'CHAR', ], [ 'UNKNOWN', - '' - ] + '', + ], ]; } } diff --git a/test/classes/UrlTest.php b/test/classes/UrlTest.php index f90ba52fc1..f3959fb061 100644 --- a/test/classes/UrlTest.php +++ b/test/classes/UrlTest.php @@ -66,7 +66,10 @@ class UrlTest extends TestCase $expected = '?db=db' . htmlentities($separator) . 'table=table' . htmlentities($separator) . $expected; - $params = ['db' => 'db', 'table' => 'table']; + $params = [ + 'db' => 'db', + 'table' => 'table', + ]; $this->assertEquals($expected, Url::getCommon($params)); } @@ -88,7 +91,10 @@ class UrlTest extends TestCase $this->assertEquals( $expected, Url::getCommonRaw( - ['db' => 'db', 'table' => 'table'], + [ + 'db' => 'db', + 'table' => 'table', + ], '#ABC#' ) ); diff --git a/test/classes/UserPreferencesTest.php b/test/classes/UserPreferencesTest.php index 2917b7bfc6..628ac1dc94 100644 --- a/test/classes/UserPreferencesTest.php +++ b/test/classes/UserPreferencesTest.php @@ -61,9 +61,9 @@ class UserPreferencesTest extends PmaTestCase [ 'Servers' => [ 1 => [ - 'hide_db' => 'testval123' - ] - ] + 'hide_db' => 'testval123', + ], + ], ], $_SESSION['ConfigFile' . $GLOBALS['server']] ); @@ -125,7 +125,7 @@ class UserPreferencesTest extends PmaTestCase $this->returnValue( [ 'ts' => '123', - 'config_data' => json_encode([1, 2]) + 'config_data' => json_encode([1, 2]), ] ) ); @@ -139,7 +139,10 @@ class UserPreferencesTest extends PmaTestCase $this->assertEquals( [ - 'config_data' => [1, 2], + 'config_data' => [ + 1, + 2, + ], 'mtime' => 123, 'type' => 'db' ], @@ -293,8 +296,8 @@ class UserPreferencesTest extends PmaTestCase $this->assertEquals( [ 'Server' => [ - 'hide_db' => 1 - ] + 'hide_db' => 1, + ], ], $result ); diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index b373e441e2..433f1eee68 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -130,9 +130,18 @@ class UtilTest extends PmaTestCase public function charsetQueryData() { return [ - ["a_b_c_d", " CHARSET=a COLLATE a_b_c_d"], - ["a_", " CHARSET=a COLLATE a_"], - ["a", " CHARSET=a"], + [ + "a_b_c_d", + " CHARSET=a COLLATE a_b_c_d", + ], + [ + "a_", + " CHARSET=a COLLATE a_", + ], + [ + "a", + " CHARSET=a", + ], ]; } @@ -183,13 +192,41 @@ class UtilTest extends PmaTestCase public function providerGetBrowseUploadFileBlock() { return [ - [10, __('B'), "10"], - [100, __('B'), "100"], - [1024, __('B'), "1,024"], - [102400, __('KiB'), "100"], - [10240000, __('MiB'), "10"], - [2147483648, __('MiB'), "2,048"], - [21474836480, __('GiB'), "20"] + [ + 10, + __('B'), + "10", + ], + [ + 100, + __('B'), + "100", + ], + [ + 1024, + __('B'), + "1,024", + ], + [ + 102400, + __('KiB'), + "100", + ], + [ + 10240000, + __('MiB'), + "10", + ], + [ + 2147483648, + __('MiB'), + "2,048", + ], + [ + 21474836480, + __('GiB'), + "20", + ], ]; } @@ -352,7 +389,11 @@ class UtilTest extends PmaTestCase $this->expectOutputRegex("/Missing parameter: field/"); Util::checkParameters( - ['db', 'table', 'field'] + [ + 'db', + 'table', + 'field', + ] ); } @@ -377,7 +418,12 @@ class UtilTest extends PmaTestCase $this->expectOutputString(""); Util::checkParameters( - ['db', 'table', 'field', 'sql_query'] + [ + 'db', + 'table', + 'field', + 'sql_query', + ] ); } @@ -408,9 +454,18 @@ class UtilTest extends PmaTestCase public function providerConvertBitDefaultValue() { return [ - ["b'",""], - ["b'01'","01"], - ["b'010111010'","010111010"] + [ + "b'", + "", + ], + [ + "b'01'", + "01", + ], + [ + "b'010111010'", + "010111010", + ], ]; } @@ -422,14 +477,38 @@ class UtilTest extends PmaTestCase public function providerUnEscapeMysqlWildcards() { return [ - ['\_test', '_test'], - ['\_\\', '_\\'], - ['\\_\%', '_%'], - ['\\\_', '\_'], - ['\\\_\\\%', '\_\%'], - ['\_\\%\_\_\%', '_%__%'], - ['\%\_', '%_'], - ['\\\%\\\_', '\%\_'] + [ + '\_test', + '_test', + ], + [ + '\_\\', + '_\\', + ], + [ + '\\_\%', + '_%', + ], + [ + '\\\_', + '\_', + ], + [ + '\\\_\\\%', + '\_\%', + ], + [ + '\_\\%\_\_\%', + '_%__%', + ], + [ + '\%\_', + '%_', + ], + [ + '\\\%\\\_', + '\%\_', + ], ]; } @@ -490,7 +569,7 @@ class UtilTest extends PmaTestCase 'Server' => [ 'host' => 'host&', 'verbose' => 'verbose', - ] + ], ]; $GLOBALS['db'] = 'database'; $GLOBALS['table'] = 'table'; @@ -519,12 +598,30 @@ class UtilTest extends PmaTestCase public function providerExpandUserString() { return [ - ['@SERVER@', 'host&'], - ['@VSERVER@', 'verbose'], - ['@DATABASE@', 'database'], - ['@TABLE@', 'table'], - ['@IGNORE@', '@IGNORE@'], - ['@PHPMYADMIN@', 'phpMyAdmin PMA_VERSION'], + [ + '@SERVER@', + 'host&', + ], + [ + '@VSERVER@', + 'verbose', + ], + [ + '@DATABASE@', + 'database', + ], + [ + '@TABLE@', + 'table', + ], + [ + '@IGNORE@', + '@IGNORE@', + ], + [ + '@PHPMYADMIN@', + 'phpMyAdmin PMA_VERSION', + ], ]; } @@ -566,7 +663,10 @@ class UtilTest extends PmaTestCase 'unsigned' => false, 'zerofill' => false, 'spec_in_brackets' => "'a','b'", - 'enum_set_values' => ['a', 'b'], + 'enum_set_values' => [ + 'a', + 'b', + ], 'attribute' => ' ', 'can_contain_collation' => true, 'displayed_type' => "set('a', 'b')" @@ -581,7 +681,10 @@ class UtilTest extends PmaTestCase 'unsigned' => false, 'zerofill' => false, 'spec_in_brackets' => "'\'a','b'", - 'enum_set_values' => ["'a", 'b'], + 'enum_set_values' => [ + "'a", + 'b', + ], 'attribute' => ' ', 'can_contain_collation' => true, 'displayed_type' => "set('\'a', 'b')" @@ -596,7 +699,10 @@ class UtilTest extends PmaTestCase 'unsigned' => false, 'zerofill' => false, 'spec_in_brackets' => "'''a','b'", - 'enum_set_values' => ["'a", 'b'], + 'enum_set_values' => [ + "'a", + 'b', + ], 'attribute' => ' ', 'can_contain_collation' => true, 'displayed_type' => "set('''a', 'b')" @@ -611,7 +717,11 @@ class UtilTest extends PmaTestCase 'unsigned' => false, 'zerofill' => false, 'spec_in_brackets' => "'a&b', 'b''c\\'d', 'e\\\\f'", - 'enum_set_values' => ['a&b', 'b\'c\'d', 'e\\f'], + 'enum_set_values' => [ + 'a&b', + 'b\'c\'d', + 'e\\f', + ], 'attribute' => ' ', 'can_contain_collation' => true, 'displayed_type' => "enum('a&b', 'b''c\\'d', 'e\\\\f')" @@ -692,10 +802,22 @@ class UtilTest extends PmaTestCase public function providerExtractValueFromFormattedSize() { return [ - [100, -1], - ["10GB", 10737418240], - ["15MB", 15728640], - ["256K", 262144] + [ + 100, + -1, + ], + [ + "10GB", + 10737418240, + ], + [ + "15MB", + 15728640, + ], + [ + "256K", + 262144, + ], ]; } @@ -728,10 +850,22 @@ class UtilTest extends PmaTestCase public function providerIsForeignKeySupported() { return [ - ['MyISAM', false], - ['innodb', true], - ['pBxT', true], - ['ndb', true] + [ + 'MyISAM', + false, + ], + [ + 'innodb', + true, + ], + [ + 'pBxT', + true, + ], + [ + 'ndb', + true, + ], ]; } @@ -789,15 +923,87 @@ class UtilTest extends PmaTestCase public function providerFormatByteDown() { return [ - [10, 2, 2, ['10', __('B')]], - [100, 2, 0, ['0', __('KiB')]], - [100, 3, 0, ['100', __('B')]], - [100, 2, 2, ['0.10', __('KiB')]], - [1034, 3, 2, ['1.01', __('KiB')]], - [100233, 3, 3, ['97.884', __('KiB')]], - [2206451, 1, 2, ['2.10', __('MiB')]], - [21474836480, 4, 0, ['20', __('GiB')]], - [doubleval(52) + doubleval(2048), 3, 1, ['2.1', 'KiB']], + [ + 10, + 2, + 2, + [ + '10', + __('B'), + ], + ], + [ + 100, + 2, + 0, + [ + '0', + __('KiB'), + ], + ], + [ + 100, + 3, + 0, + [ + '100', + __('B'), + ], + ], + [ + 100, + 2, + 2, + [ + '0.10', + __('KiB'), + ], + ], + [ + 1034, + 3, + 2, + [ + '1.01', + __('KiB'), + ], + ], + [ + 100233, + 3, + 3, + [ + '97.884', + __('KiB'), + ], + ], + [ + 2206451, + 1, + 2, + [ + '2.10', + __('MiB'), + ], + ], + [ + 21474836480, + 4, + 0, + [ + '20', + __('GiB'), + ], + ], + [ + doubleval(52) + doubleval(2048), + 3, + 1, + [ + '2.1', + 'KiB', + ], + ], ]; } @@ -888,21 +1094,96 @@ class UtilTest extends PmaTestCase public function providerFormatNumber() { return [ - [10, 2, 2, '10 '], - [100, 2, 0, '100 '], - [100, 2, 2, '100 '], - [-1000.454, 4, 2, '-1,000.45 '], - [0.00003, 3, 2, '30 µ'], - [0.003, 3, 3, '3 m'], - [-0.003, 6, 0, '-3,000 µ'], - [100.98, 0, 2, '100.98'], - [21010101, 0, 2, '21,010,101.00'], - [1100000000, 5, 0, '1,100 M'], - [20000, 2, 2, '20 k'], - [20011, 2, 2, '20.01 k'], - [123456789, 6, 0, '123,457 k'], - [-123456789, 4, 2, '-123.46 M'], - [0, 6, 0, '0'] + [ + 10, + 2, + 2, + '10 ', + ], + [ + 100, + 2, + 0, + '100 ', + ], + [ + 100, + 2, + 2, + '100 ', + ], + [ + -1000.454, + 4, + 2, + '-1,000.45 ', + ], + [ + 0.00003, + 3, + 2, + '30 µ', + ], + [ + 0.003, + 3, + 3, + '3 m', + ], + [ + -0.003, + 6, + 0, + '-3,000 µ', + ], + [ + 100.98, + 0, + 2, + '100.98', + ], + [ + 21010101, + 0, + 2, + '21,010,101.00', + ], + [ + 1100000000, + 5, + 0, + '1,100 M', + ], + [ + 20000, + 2, + 2, + '20 k', + ], + [ + 20011, + 2, + 2, + '20.01 k', + ], + [ + 123456789, + 6, + 0, + '123,457 k', + ], + [ + -123456789, + 4, + 2, + '-123.46 M', + ], + [ + 0, + 6, + 0, + '0', + ], ]; } @@ -937,7 +1218,7 @@ class UtilTest extends PmaTestCase [1024], ["1024Mb"], [2147483648], - ["some_string"] + ["some_string"], ]; } @@ -1139,7 +1420,10 @@ class UtilTest extends PmaTestCase public function testGetDropdown() { $name = "&test_dropdown_name"; - $choices = ["value_1" => "label_1", "value&_2\"" => "label_2"]; + $choices = [ + "value_1" => "label_1", + "value&_2\"" => "label_2", + ]; $active_choice = null; $id = "test_<dropdown>_name"; @@ -1175,7 +1459,10 @@ class UtilTest extends PmaTestCase public function testGetDropdownWithActive() { $name = "&test_dropdown_name"; - $choices = ["value_1" => "label_1", "value&_2\"" => "label_2"]; + $choices = [ + "value_1" => "label_1", + "value&_2\"" => "label_2", + ]; $active_choice = "value&_2\""; $id = "test_<dropdown>_name"; @@ -1231,13 +1518,41 @@ class UtilTest extends PmaTestCase public function providerGetFormattedMaximumUploadSize() { return [ - [10, __('B'), "10"], - [100, __('B'), "100"], - [1024, __('B'), "1,024"], - [102400, __('KiB'), "100"], - [10240000, __('MiB'), "10"], - [2147483648, __('MiB'), "2,048"], - [21474836480, __('GiB'), "20"] + [ + 10, + __('B'), + "10", + ], + [ + 100, + __('B'), + "100", + ], + [ + 1024, + __('B'), + "1,024", + ], + [ + 102400, + __('KiB'), + "100", + ], + [ + 10240000, + __('MiB'), + "10", + ], + [ + 2147483648, + __('MiB'), + "2,048", + ], + [ + 21474836480, + __('GiB'), + "20", + ], ]; } @@ -1345,7 +1660,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFields() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value_2' => 'choice_2']; + $choices = [ + 'value_1' => 'choice_1', + 'value_2' => 'choice_2', + ]; $out = ""; foreach ($choices as $choice_value => $choice_label) { @@ -1376,7 +1694,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFieldsWithChecked() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value_2' => 'choice_2']; + $choices = [ + 'value_1' => 'choice_1', + 'value_2' => 'choice_2', + ]; $checked_choice = "value_2"; $out = ""; @@ -1415,7 +1736,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFieldsWithCheckedWithClass() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value_2' => 'choice_2']; + $choices = [ + 'value_1' => 'choice_1', + 'value_2' => 'choice_2', + ]; $checked_choice = "value_2"; $class = "test_class"; @@ -1462,7 +1786,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFieldsWithoutBR() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value&_<2>' => 'choice_2']; + $choices = [ + 'value_1' => 'choice_1', + 'value&_<2>' => 'choice_2', + ]; $checked_choice = "choice_2"; $out = ""; @@ -1500,7 +1827,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFieldsEscapeLabelEscapeLabel() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value_&2' => 'choice&_<2>']; + $choices = [ + 'value_1' => 'choice_1', + 'value_&2' => 'choice&_<2>', + ]; $checked_choice = "value_2"; $out = ""; @@ -1541,7 +1871,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFieldsEscapeLabelNotEscapeLabel() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value_&2' => 'choice&_<2>']; + $choices = [ + 'value_1' => 'choice_1', + 'value_&2' => 'choice&_<2>', + ]; $checked_choice = "value_2"; $out = ""; @@ -1582,7 +1915,10 @@ class UtilTest extends PmaTestCase public function testGetRadioFieldsEscapeLabelEscapeLabelWithClass() { $name = "test_display_radio"; - $choices = ['value_1' => 'choice_1', 'value_&2' => 'choice&_<2>']; + $choices = [ + 'value_1' => 'choice_1', + 'value_&2' => 'choice&_<2>', + ]; $checked_choice = "value_2"; $class = "test_class"; @@ -1646,15 +1982,42 @@ class UtilTest extends PmaTestCase public function providerGetTitleForTarget() { return [ - ['tbl_structure.php', __('Structure')], - ['tbl_sql.php', __('SQL'),], - ['tbl_select.php', __('Search'),], - ['tbl_change.php', __('Insert')], - ['sql.php', __('Browse')], - ['db_structure.php', __('Structure')], - ['db_sql.php', __('SQL')], - ['db_search.php', __('Search')], - ['db_operations.php', __('Operations')], + [ + 'tbl_structure.php', + __('Structure'), + ], + [ + 'tbl_sql.php', + __('SQL'), + ], + [ + 'tbl_select.php', + __('Search'), + ], + [ + 'tbl_change.php', + __('Insert'), + ], + [ + 'sql.php', + __('Browse'), + ], + [ + 'db_structure.php', + __('Structure'), + ], + [ + 'db_sql.php', + __('SQL'), + ], + [ + 'db_search.php', + __('Search'), + ], + [ + 'db_operations.php', + __('Operations'), + ], ]; } @@ -1691,8 +2054,16 @@ class UtilTest extends PmaTestCase public function providerLocalisedDate() { return [ - [1227455558, '', 'Nov 23, 2008 at 03:52 PM'], - [1227455558, '%Y-%m-%d %H:%M:%S %a', '2008-11-23 15:52:38 Sun'] + [ + 1227455558, + '', + 'Nov 23, 2008 at 03:52 PM', + ], + [ + 1227455558, + '%Y-%m-%d %H:%M:%S %a', + '2008-11-23 15:52:38 Sun', + ], ]; } @@ -1729,8 +2100,14 @@ class UtilTest extends PmaTestCase public function providerTimespanFormat() { return [ - [1258, '0 days, 0 hours, 20 minutes and 58 seconds'], - [821958, '9 days, 12 hours, 19 minutes and 18 seconds'] + [ + 1258, + '0 days, 0 hours, 20 minutes and 58 seconds', + ], + [ + 821958, + '9 days, 12 hours, 19 minutes and 18 seconds', + ], ]; } @@ -1765,9 +2142,13 @@ class UtilTest extends PmaTestCase [ 20131009, 64, - '0000000000000000000000000000000000000001001100110010110011000001' + '0000000000000000000000000000000000000001001100110010110011000001', + ], + [ + 5, + 32, + '00000000000000000000000000000101', ], - [5, 32, '00000000000000000000000000000101'] ]; } @@ -1798,10 +2179,22 @@ class UtilTest extends PmaTestCase public function providerUnQuote() { return [ - ['"test\'"', "test'"], - ["'test''", "test'"], - ["`test'`", "test'"], - ["'test'test", "'test'test"] + [ + '"test\'"', + "test'", + ], + [ + "'test''", + "test'", + ], + [ + "`test'`", + "test'", + ], + [ + "'test'test", + "'test'test", + ], ]; } @@ -1832,10 +2225,22 @@ class UtilTest extends PmaTestCase public function providerUnQuoteSelectedChar() { return [ - ['"test\'"', "test'"], - ["'test''", "'test''"], - ["`test'`", "`test'`"], - ["'test'test", "'test'test"] + [ + '"test\'"', + "test'", + ], + [ + "'test''", + "'test''", + ], + [ + "`test'`", + "`test'`", + ], + [ + "'test'test", + "'test'test", + ], ]; } @@ -1867,13 +2272,32 @@ class UtilTest extends PmaTestCase public function providerBackquote() { return [ - ['0', '`0`'], - ['test', '`test`'], - ['te`st', '`te``st`'], [ - ['test', 'te`st', '', '*'], - ['`test`', '`te``st`', '', '*'] - ] + '0', + '`0`', + ], + [ + 'test', + '`test`', + ], + [ + 'te`st', + '`te``st`', + ], + [ + [ + 'test', + 'te`st', + '', + '*', + ], + [ + '`test`', + '`te``st`', + '', + '*', + ], + ], ]; } @@ -1909,13 +2333,32 @@ class UtilTest extends PmaTestCase public function providerBackquoteCompat() { return [ - ['0', '"0"'], - ['test', '"test"'], - ['te`st', '"te`st"'], [ - ['test', 'te`st', '', '*'], - ['"test"', '"te`st"', '', '*'] - ] + '0', + '"0"', + ], + [ + 'test', + '"test"', + ], + [ + 'te`st', + '"te`st"', + ], + [ + [ + 'test', + 'te`st', + '', + '*', + ], + [ + '"test"', + '"te`st"', + '', + '*', + ], + ], ]; } @@ -2012,8 +2455,14 @@ class UtilTest extends PmaTestCase public function providerUserDir() { return [ - ['/var/pma_tmp/%u/', "/var/pma_tmp/root/"], - ['/home/%u/pma', "/home/root/pma/"] + [ + '/var/pma_tmp/%u/', + "/var/pma_tmp/root/", + ], + [ + '/home/%u/pma', + "/home/root/pma/", + ], ]; } @@ -2044,10 +2493,22 @@ class UtilTest extends PmaTestCase public function providerDuplicateFirstNewline() { return [ - ['test', 'test'], - ["\r\ntest", "\n\r\ntest"], - ["\ntest", "\ntest"], - ["\n\r\ntest", "\n\r\ntest"] + [ + 'test', + 'test', + ], + [ + "\r\ntest", + "\n\r\ntest", + ], + [ + "\ntest", + "\ntest", + ], + [ + "\n\r\ntest", + "\n\r\ntest", + ], ]; } @@ -2084,7 +2545,10 @@ class UtilTest extends PmaTestCase $GLOBALS['cfg']['LinkLengthLimit'] = $limit; try { $result = call_user_func_array( - ['PhpMyAdmin\Util', 'linkOrButton'], + [ + 'PhpMyAdmin\Util', + 'linkOrButton', + ], $params ); $this->assertEquals($match, $result); @@ -2102,22 +2566,38 @@ class UtilTest extends PmaTestCase { return [ [ - ['index.php', 'text'], + [ + 'index.php', + 'text', + ], 1000, - '<a href="index.php" >text</a>' + '<a href="index.php" >text</a>', ], [ - ['index.php?some=parameter', 'text'], + [ + 'index.php?some=parameter', + 'text', + ], 20, '<a href="index.php" data-post="some=parameter">text</a>', ], [ - ['index.php', 'text', [], 'target'], + [ + 'index.php', + 'text', + [], + 'target', + ], 1000, '<a href="index.php" target="target">text</a>', ], [ - ['url.php?url=http://phpmyadmin.net/', 'text', [], '_blank'], + [ + 'url.php?url=http://phpmyadmin.net/', + 'text', + [], + '_blank', + ], 1000, '<a href="url.php?url=http://phpmyadmin.net/" target="_blank" rel="noopener noreferrer">text</a>', ], diff --git a/test/classes/Utils/HttpRequestTest.php b/test/classes/Utils/HttpRequestTest.php index 9cc7e75db6..d5da834350 100644 --- a/test/classes/Utils/HttpRequestTest.php +++ b/test/classes/Utils/HttpRequestTest.php @@ -127,7 +127,7 @@ class HttpRequestTest extends PmaTestCase $return_only_status, null, '', - CURLOPT_CAPATH + CURLOPT_CAPATH, ]); $this->validateHttp($result, $expected); } @@ -157,7 +157,7 @@ class HttpRequestTest extends PmaTestCase $return_only_status, null, '', - CURLOPT_CAINFO + CURLOPT_CAINFO, ]); $this->validateHttp($result, $expected); } @@ -242,11 +242,36 @@ class HttpRequestTest extends PmaTestCase public function httpRequests() { return [ - ["https://www.phpmyadmin.net/test/data", "GET", true, true], - ["https://www.phpmyadmin.net/test/data", "POST", true, null], - ["https://nonexisting.phpmyadmin.net/test/data", "GET", true, null], - ["https://www.phpmyadmin.net/test/data","GET", false, "TEST DATA"], - ["https://www.phpmyadmin.net/test/nothing","GET", true, false], + [ + "https://www.phpmyadmin.net/test/data", + "GET", + true, + true, + ], + [ + "https://www.phpmyadmin.net/test/data", + "POST", + true, + null, + ], + [ + "https://nonexisting.phpmyadmin.net/test/data", + "GET", + true, + null, + ], + [ + "https://www.phpmyadmin.net/test/data", + "GET", + false, + "TEST DATA", + ], + [ + "https://www.phpmyadmin.net/test/nothing", + "GET", + true, + false, + ], ]; } } diff --git a/test/classes/VersionInformationTest.php b/test/classes/VersionInformationTest.php index 350e2a642a..0335ac8fe6 100644 --- a/test/classes/VersionInformationTest.php +++ b/test/classes/VersionInformationTest.php @@ -102,25 +102,82 @@ class VersionInformationTest extends PmaTestCase public function dataVersions() { return [ - ['1.0.0', 1000050], - ['2.0.0.2-dev', 2000002], - ['3.4.2.1', 3040251], - ['3.4.2-dev3', 3040203], - ['3.4.2-dev', 3040200], - ['3.4.2-pl', 3040260], - ['3.4.2-pl3', 3040263], - ['4.4.2-rc22', 4040252], - ['4.4.2-rc', 4040230], - ['4.4.22-beta22', 4042242], - ['4.4.22-beta', 4042220], - ['4.4.21-alpha22', 4042132], - ['4.4.20-alpha', 4042010], - ['4.40.20-alpha-dev', 4402010], - ['4.4a', 4000050], - ['4.4.4-test', 4040400], - ['4.1.0', 4010050], - ['4.0.1.3', 4000153], - ['4.1-dev', 4010000], + [ + '1.0.0', + 1000050, + ], + [ + '2.0.0.2-dev', + 2000002, + ], + [ + '3.4.2.1', + 3040251, + ], + [ + '3.4.2-dev3', + 3040203, + ], + [ + '3.4.2-dev', + 3040200, + ], + [ + '3.4.2-pl', + 3040260, + ], + [ + '3.4.2-pl3', + 3040263, + ], + [ + '4.4.2-rc22', + 4040252, + ], + [ + '4.4.2-rc', + 4040230, + ], + [ + '4.4.22-beta22', + 4042242, + ], + [ + '4.4.22-beta', + 4042220, + ], + [ + '4.4.21-alpha22', + 4042132, + ], + [ + '4.4.20-alpha', + 4042010, + ], + [ + '4.40.20-alpha-dev', + 4402010, + ], + [ + '4.4a', + 4000050, + ], + [ + '4.4.4-test', + 4040400, + ], + [ + '4.1.0', + 4010050, + ], + [ + '4.0.1.3', + 4000153, + ], + [ + '4.1-dev', + 4010000, + ], ]; } @@ -132,7 +189,7 @@ class VersionInformationTest extends PmaTestCase public function testGetLatestCompatibleVersionWithSingleServer() { $GLOBALS['cfg']['Servers'] = [ - [] + [], ]; $mockVersionInfo = $this->getMockBuilder('PhpMyAdmin\VersionInformation') @@ -168,7 +225,7 @@ class VersionInformationTest extends PmaTestCase { $GLOBALS['cfg']['Servers'] = [ [], - [] + [], ]; $mockVersionInfo = $this->getMockBuilder('PhpMyAdmin\VersionInformation') @@ -199,7 +256,7 @@ class VersionInformationTest extends PmaTestCase { $GLOBALS['cfg']['Servers'] = [ [], - [] + [], ]; $mockVersionInfo = $this->getMockBuilder('PhpMyAdmin\VersionInformation') diff --git a/test/classes/ZipExtensionTest.php b/test/classes/ZipExtensionTest.php index 427c9a92c4..c4e5ef275f 100644 --- a/test/classes/ZipExtensionTest.php +++ b/test/classes/ZipExtensionTest.php @@ -64,7 +64,7 @@ class ZipExtensionTest extends PmaTestCase [ 'error' => '', 'data' => 'TEST FILE' . "\n" - ] + ], ], [ './test/test_data/test.zip', @@ -72,8 +72,8 @@ class ZipExtensionTest extends PmaTestCase [ 'error' => 'Error in ZIP archive: Could not find "test"', 'data' => '' - ] - ] + ], + ], ]; } @@ -106,8 +106,8 @@ class ZipExtensionTest extends PmaTestCase [ './test/test_data/test.zip', '/test/', - 'test.file' - ] + 'test.file', + ], ]; } @@ -184,7 +184,10 @@ class ZipExtensionTest extends PmaTestCase false, $this->zipExtension->createFile( "Content", - ["name1.txt", "name2.txt"] + [ + "name1.txt", + "name2.txt", + ] ) ); } @@ -197,8 +200,14 @@ class ZipExtensionTest extends PmaTestCase public function testCreateMultiFile() { $file = $this->zipExtension->createFile( - ["Content", 'Content2'], - ["name1.txt", "name2.txt"] + [ + "Content", + 'Content2', + ], + [ + "name1.txt", + "name2.txt", + ] ); $this->assertNotEmpty($file); diff --git a/test/libraries/FilesTest.php b/test/libraries/FilesTest.php index b209653258..71dc333741 100644 --- a/test/libraries/FilesTest.php +++ b/test/libraries/FilesTest.php @@ -54,8 +54,14 @@ class FilesTest extends TestCase public function listScripts() { return [ - ['js/whitelist.php', 'var PMA_gotoWhitelist'], - ['js/messages.php', 'var PMA_messages = new Array();'], + [ + 'js/whitelist.php', + 'var PMA_gotoWhitelist', + ], + [ + 'js/messages.php', + 'var PMA_messages = new Array();', + ], ]; } } diff --git a/test/selenium/ExportTest.php b/test/selenium/ExportTest.php index 29f9dbee14..95632126ce 100644 --- a/test/selenium/ExportTest.php +++ b/test/selenium/ExportTest.php @@ -118,7 +118,7 @@ class ExportTest extends TestBase return [ [ 'CSV', - ['"1","2"'] + ['"1","2"'], ], [ 'SQL', @@ -126,12 +126,12 @@ class ExportTest extends TestBase "CREATE TABLE IF NOT EXISTS `test_table`", "INSERT INTO `test_table` (`id`, `val`) VALUES", "(1, 2)", - ] + ], ], [ 'JSON', - ['{"id":"1","val":"2"}'] - ] + ['{"id":"1","val":"2"}'], + ], ]; } diff --git a/test/selenium/Table/CreateTest.php b/test/selenium/Table/CreateTest.php index 2c636fa1be..cca1660148 100644 --- a/test/selenium/Table/CreateTest.php +++ b/test/selenium/Table/CreateTest.php @@ -81,7 +81,7 @@ class CreateTest extends TestBase "field_0_6" => "UNSIGNED", "field_1_2" => "VARCHAR", "field_1_5" => "utf8_general_ci", - "field_1_4" => "As defined:" + "field_1_4" => "As defined:", ]; foreach ($column_dropdown_details as $selector => $value) { diff --git a/test/selenium/TestBase.php b/test/selenium/TestBase.php index 2ac630f7de..c34f7e3e22 100644 --- a/test/selenium/TestBase.php +++ b/test/selenium/TestBase.php @@ -1051,7 +1051,7 @@ abstract class TestBase extends TestCase $payload = json_encode( [ 'status' => 'failed', - 'reason' => $e->getMessage() + 'reason' => $e->getMessage(), ] ); diff --git a/transformation_overview.php b/transformation_overview.php index 70574f2df9..8af8298d7f 100644 --- a/transformation_overview.php +++ b/transformation_overview.php @@ -38,15 +38,16 @@ foreach ($types['mimetype'] as $key => $mimetype) { } } $transformation_types = [ - 'transformation', 'input_transformation' + 'transformation', + 'input_transformation', ]; $label = [ 'transformation' => __('Available browser display transformations'), - 'input_transformation' => __('Available input transformations') + 'input_transformation' => __('Available input transformations'), ]; $th = [ 'transformation' => __('Browser display transformation'), - 'input_transformation' => __('Input transformation') + 'input_transformation' => __('Input transformation'), ]; ?> <br> diff --git a/transformation_wrapper.php b/transformation_wrapper.php index c5adcf3e93..0fc15f3148 100644 --- a/transformation_wrapper.php +++ b/transformation_wrapper.php @@ -44,7 +44,7 @@ $request_params = [ 'ct', 'sql_query', 'transform_key', - 'where_clause' + 'where_clause', ]; $size_params = [ 'newHeight', diff --git a/view_create.php b/view_create.php index 248a110f2a..57f2d89637 100644 --- a/view_create.php +++ b/view_create.php @@ -40,12 +40,12 @@ $view_algorithm_options = [ $view_with_options = [ 'CASCADED', - 'LOCAL' + 'LOCAL', ]; $view_security_options = [ 'DEFINER', - 'INVOKER' + 'INVOKER', ]; // View name is a compulsory field |