From 673c194b0197f3c14fffddfa2071640d31e57dfe Mon Sep 17 00:00:00 2001 From: Rosheen Naeem Date: Thu, 6 Aug 2020 17:12:15 +0500 Subject: [PATCH] Fixed underscore prefixes Signed-off-by: Rosheen Naeem --- .../Table/FindReplaceController.php | 30 +++---- .../Controllers/Table/SearchController.php | 68 ++++++++-------- .../Controllers/Table/StructureController.php | 10 +-- .../Table/ZoomSearchController.php | 78 +++++++++---------- .../Table/RelationControllerTest.php | 20 ++--- .../Table/SearchControllerTest.php | 10 +-- .../Table/StructureControllerTest.php | 10 +-- test/classes/Stubs/DbiDummy.php | 14 ++-- test/classes/Stubs/Response.php | 18 ++--- test/selenium/CreateRemoveUserTest.php | 16 ++-- 10 files changed, 137 insertions(+), 137 deletions(-) diff --git a/libraries/classes/Controllers/Table/FindReplaceController.php b/libraries/classes/Controllers/Table/FindReplaceController.php index 5d41e5667c..940c7a348b 100644 --- a/libraries/classes/Controllers/Table/FindReplaceController.php +++ b/libraries/classes/Controllers/Table/FindReplaceController.php @@ -29,13 +29,13 @@ use function strpos; class FindReplaceController extends AbstractController { /** @var array */ - private $_columnNames; + private $columnNames; /** @var array */ - private $_columnTypes; + private $columnTypes; /** @var string */ - private $_connectionCharSet; + private $connectionCharSet; /** * @param Response $response Response object @@ -47,10 +47,10 @@ class FindReplaceController extends AbstractController public function __construct($response, $dbi, Template $template, $db, $table) { parent::__construct($response, $dbi, $template, $db, $table); - $this->_columnNames = []; - $this->_columnTypes = []; + $this->columnNames = []; + $this->columnTypes = []; $this->loadTableInfo(); - $this->_connectionCharSet = $this->dbi->fetchValue( + $this->connectionCharSet = $this->dbi->fetchValue( 'SELECT @@character_set_connection' ); } @@ -90,7 +90,7 @@ class FindReplaceController extends AbstractController foreach ($columns as $row) { // set column name - $this->_columnNames[] = $row['Field']; + $this->columnNames[] = $row['Field']; $type = $row['Type']; // reformat mysql query output @@ -111,7 +111,7 @@ class FindReplaceController extends AbstractController if (empty($type)) { $type = ' '; } - $this->_columnTypes[] = $type; + $this->columnTypes[] = $type; } } @@ -129,8 +129,8 @@ class FindReplaceController extends AbstractController ); } - $column_names = $this->_columnNames; - $column_types = $this->_columnTypes; + $column_names = $this->columnNames; + $column_types = $this->columnTypes; $types = []; $num_cols = count($column_names); for ($i = 0; $i < $num_cols; $i++) { @@ -161,7 +161,7 @@ class FindReplaceController extends AbstractController $_POST['find'], $_POST['replaceWith'], $useRegex, - $this->_connectionCharSet + $this->connectionCharSet ); $this->response->addJSON('preview', $preview); } @@ -173,7 +173,7 @@ class FindReplaceController extends AbstractController $_POST['findString'], $_POST['replaceWith'], $_POST['useRegex'], - $this->_connectionCharSet + $this->connectionCharSet ); $this->response->addHTML( Generator::getMessage( @@ -202,7 +202,7 @@ class FindReplaceController extends AbstractController $useRegex, $charSet ) { - $column = $this->_columnNames[$columnIndex]; + $column = $this->columnNames[$columnIndex]; if ($useRegex) { $result = $this->getRegexReplaceRows( $columnIndex, @@ -258,7 +258,7 @@ class FindReplaceController extends AbstractController $replaceWith, $charSet ) { - $column = $this->_columnNames[$columnIndex]; + $column = $this->columnNames[$columnIndex]; $sql_query = 'SELECT ' . Util::backquote($column) . ',' . ' 1,' // to add an extra column that will have replaced value @@ -330,7 +330,7 @@ class FindReplaceController extends AbstractController $useRegex, $charSet ) { - $column = $this->_columnNames[$columnIndex]; + $column = $this->columnNames[$columnIndex]; if ($useRegex) { $toReplace = $this->getRegexReplaceRows( $columnIndex, diff --git a/libraries/classes/Controllers/Table/SearchController.php b/libraries/classes/Controllers/Table/SearchController.php index 9a54e5a35a..8d8a16f658 100644 --- a/libraries/classes/Controllers/Table/SearchController.php +++ b/libraries/classes/Controllers/Table/SearchController.php @@ -38,49 +38,49 @@ class SearchController extends AbstractController * @access private * @var array */ - private $_columnNames; + private $columnNames; /** * Types of columns * * @access private * @var array */ - private $_columnTypes; + private $columnTypes; /** * Types of columns without any replacement * * @access private * @var array */ - private $_originalColumnTypes; + private $originalColumnTypes; /** * Collations of columns * * @access private * @var array */ - private $_columnCollations; + private $columnCollations; /** * Null Flags of columns * * @access private * @var array */ - private $_columnNullFlags; + private $columnNullFlags; /** * Whether a geometry column is present * * @access private * @var bool */ - private $_geomColumnFlag; + private $geomColumnFlag; /** * Foreign Keys * * @access private * @var array */ - private $_foreigners; + private $foreigners; /** @var Search */ private $search; @@ -109,13 +109,13 @@ class SearchController extends AbstractController parent::__construct($response, $dbi, $template, $db, $table); $this->search = $search; $this->relation = $relation; - $this->_columnNames = []; - $this->_columnTypes = []; - $this->_originalColumnTypes = []; - $this->_columnCollations = []; - $this->_columnNullFlags = []; - $this->_geomColumnFlag = false; - $this->_foreigners = []; + $this->columnNames = []; + $this->columnTypes = []; + $this->originalColumnTypes = []; + $this->columnCollations = []; + $this->columnNullFlags = []; + $this->geomColumnFlag = false; + $this->foreigners = []; $this->loadTableInfo(); } @@ -137,14 +137,14 @@ class SearchController extends AbstractController foreach ($columns as $row) { // set column name - $this->_columnNames[] = $row['Field']; + $this->columnNames[] = $row['Field']; $type = $row['Type']; // before any replacement - $this->_originalColumnTypes[] = mb_strtolower($type); + $this->originalColumnTypes[] = mb_strtolower($type); // check whether table contains geometric columns if (in_array($type, $geom_types)) { - $this->_geomColumnFlag = true; + $this->geomColumnFlag = true; } // reformat mysql query output if (strncasecmp($type, 'set', 3) == 0 @@ -164,16 +164,16 @@ class SearchController extends AbstractController if (empty($type)) { $type = ' '; } - $this->_columnTypes[] = $type; - $this->_columnNullFlags[] = $row['Null']; - $this->_columnCollations[] + $this->columnTypes[] = $type; + $this->columnNullFlags[] = $row['Null']; + $this->columnCollations[] = ! empty($row['Collation']) && $row['Collation'] !== 'NULL' ? $row['Collation'] : ''; } // end for // Retrieve foreign keys - $this->_foreigners = $this->relation->getForeigners($this->db, $this->table); + $this->foreigners = $this->relation->getForeigners($this->db, $this->table); } /** @@ -300,10 +300,10 @@ class SearchController extends AbstractController 'table' => $this->table, 'goto' => $goto, 'self' => $this, - 'geom_column_flag' => $this->_geomColumnFlag, - 'column_names' => $this->_columnNames, - 'column_types' => $this->_columnTypes, - 'column_collations' => $this->_columnCollations, + 'geom_column_flag' => $this->geomColumnFlag, + 'column_names' => $this->columnNames, + 'column_types' => $this->columnTypes, + 'column_collations' => $this->columnCollations, 'default_sliders_state' => $cfg['InitialSlidersState'], 'max_rows' => intval($cfg['MaxRows']), ]); @@ -357,13 +357,13 @@ class SearchController extends AbstractController ), ]; //Gets column's type and collation - $type = $this->_columnTypes[$column_index]; - $collation = $this->_columnCollations[$column_index]; + $type = $this->columnTypes[$column_index]; + $collation = $this->columnCollations[$column_index]; $cleanType = preg_replace('@\(.*@s', '', $type); //Gets column's comparison operators depending on column type $typeOperators = $this->dbi->types->getTypeOperatorsHtml( $cleanType, - $this->_columnNullFlags[$column_index], + $this->columnNullFlags[$column_index], $selected_operator ); $func = $this->template->render('table/search/column_comparison_operators', [ @@ -372,8 +372,8 @@ class SearchController extends AbstractController ]); //Gets link to browse foreign data(if any) and criteria inputbox $foreignData = $this->relation->getForeignData( - $this->_foreigners, - $this->_columnNames[$column_index], + $this->foreigners, + $this->columnNames[$column_index], false, '', '' @@ -381,7 +381,7 @@ class SearchController extends AbstractController $htmlAttributes = ''; if (in_array($cleanType, $this->dbi->types->getIntegerTypes())) { $extractedColumnspec = Util::extractColumnSpec( - $this->_originalColumnTypes[$column_index] + $this->originalColumnTypes[$column_index] ); $is_unsigned = $extractedColumnspec['unsigned']; $minMaxValues = $this->dbi->types->getIntegerRange( @@ -402,9 +402,9 @@ class SearchController extends AbstractController 'html_attributes' => $htmlAttributes, 'column_id' => 'fieldID_', 'in_zoom_search_edit' => false, - 'foreigners' => $this->_foreigners, - 'column_name' => $this->_columnNames[$column_index], - 'column_name_hash' => md5($this->_columnNames[$column_index]), + 'foreigners' => $this->foreigners, + 'column_name' => $this->columnNames[$column_index], + 'column_name_hash' => md5($this->columnNames[$column_index]), 'foreign_data' => $foreignData, 'table' => $this->table, 'column_index' => $search_index, diff --git a/libraries/classes/Controllers/Table/StructureController.php b/libraries/classes/Controllers/Table/StructureController.php index f531cf7c64..ca0ef86402 100644 --- a/libraries/classes/Controllers/Table/StructureController.php +++ b/libraries/classes/Controllers/Table/StructureController.php @@ -63,7 +63,7 @@ class StructureController extends AbstractController protected $table_obj; /** @var string The URL query string */ - protected $_url_query; + protected $url_query; /** @var CreateAddField */ private $createAddField; @@ -105,7 +105,7 @@ class StructureController extends AbstractController $this->transformations = $transformations; $this->relationCleanup = $relationCleanup; - $this->_url_query = Url::getCommonRaw(['db' => $db, 'table' => $table]); + $this->url_query = Url::getCommonRaw(['db' => $db, 'table' => $table]); $this->table_obj = $this->dbi->getTable($this->db, $this->table); } @@ -150,7 +150,7 @@ class StructureController extends AbstractController $url_params['goto'] = Url::getFromRoute('/table/structure'); $url_params['back'] = Url::getFromRoute('/table/structure'); - $this->_url_query = Url::getCommonRaw($url_params); + $this->url_query = Url::getCommonRaw($url_params); $primary = Index::getPrimary($this->table, $this->db); $columns_with_index = $this->dbi @@ -1580,7 +1580,7 @@ class StructureController extends AbstractController 'db_is_system_schema' => $db_is_system_schema, 'tbl_is_view' => $tbl_is_view, 'mime_map' => $mime_map, - 'url_query' => $this->_url_query, + 'url_query' => $this->url_query, 'titles' => $titles, 'tbl_storage_engine' => $tbl_storage_engine, 'primary' => $primary_index, @@ -1730,7 +1730,7 @@ class StructureController extends AbstractController 'tbl_is_view' => $tbl_is_view, 'db_is_system_schema' => $db_is_system_schema, 'tbl_storage_engine' => $tbl_storage_engine, - 'url_query' => $this->_url_query, + 'url_query' => $this->url_query, 'table_collation' => $tableCollation, 'is_innodb' => $is_innodb, 'mergetable' => $mergetable, diff --git a/libraries/classes/Controllers/Table/ZoomSearchController.php b/libraries/classes/Controllers/Table/ZoomSearchController.php index 8ff4c4105c..2fb1fad5c4 100644 --- a/libraries/classes/Controllers/Table/ZoomSearchController.php +++ b/libraries/classes/Controllers/Table/ZoomSearchController.php @@ -42,25 +42,25 @@ class ZoomSearchController extends AbstractController private $relation; /** @var array */ - private $_columnNames; + private $columnNames; /** @var array */ - private $_columnTypes; + private $columnTypes; /** @var array */ - private $_originalColumnTypes; + private $originalColumnTypes; /** @var array */ - private $_columnCollations; + private $columnCollations; /** @var array */ - private $_columnNullFlags; + private $columnNullFlags; /** @var bool Whether a geometry column is present */ - private $_geomColumnFlag; + private $geomColumnFlag; /** @var array Foreign keys */ - private $_foreigners; + private $foreigners; /** * @param Response $response A Response instance. @@ -76,13 +76,13 @@ class ZoomSearchController extends AbstractController parent::__construct($response, $dbi, $template, $db, $table); $this->search = $search; $this->relation = $relation; - $this->_columnNames = []; - $this->_columnTypes = []; - $this->_originalColumnTypes = []; - $this->_columnCollations = []; - $this->_columnNullFlags = []; - $this->_geomColumnFlag = false; - $this->_foreigners = []; + $this->columnNames = []; + $this->columnTypes = []; + $this->originalColumnTypes = []; + $this->columnCollations = []; + $this->columnNullFlags = []; + $this->geomColumnFlag = false; + $this->foreigners = []; $this->loadTableInfo(); } @@ -177,14 +177,14 @@ class ZoomSearchController extends AbstractController foreach ($columns as $row) { // set column name - $this->_columnNames[] = $row['Field']; + $this->columnNames[] = $row['Field']; $type = $row['Type']; // before any replacement - $this->_originalColumnTypes[] = mb_strtolower($type); + $this->originalColumnTypes[] = mb_strtolower($type); // check whether table contains geometric columns if (in_array($type, $geom_types)) { - $this->_geomColumnFlag = true; + $this->geomColumnFlag = true; } // reformat mysql query output if (strncasecmp($type, 'set', 3) == 0 @@ -204,16 +204,16 @@ class ZoomSearchController extends AbstractController if (empty($type)) { $type = ' '; } - $this->_columnTypes[] = $type; - $this->_columnNullFlags[] = $row['Null']; - $this->_columnCollations[] + $this->columnTypes[] = $type; + $this->columnNullFlags[] = $row['Null']; + $this->columnCollations[] = ! empty($row['Collation']) && $row['Collation'] !== 'NULL' ? $row['Collation'] : ''; } // end for // Retrieve foreign keys - $this->_foreigners = $this->relation->getForeigners($this->db, $this->table); + $this->foreigners = $this->relation->getForeigners($this->db, $this->table); } /** @@ -234,7 +234,7 @@ class ZoomSearchController extends AbstractController ); } - $column_names = $this->_columnNames; + $column_names = $this->columnNames; $criteria_column_names = $_POST['criteriaColumnNames'] ?? null; $keys = []; for ($i = 0; $i < 4; $i++) { @@ -254,7 +254,7 @@ class ZoomSearchController extends AbstractController 'table' => $this->table, 'goto' => $goto, 'self' => $this, - 'geom_column_flag' => $this->_geomColumnFlag, + 'geom_column_flag' => $this->geomColumnFlag, 'column_names' => $column_names, 'data_label' => $dataLabel, 'keys' => $keys, @@ -315,7 +315,7 @@ class ZoomSearchController extends AbstractController return; } - $key = array_search($field, $this->_columnNames); + $key = array_search($field, $this->columnNames); $search_index = (isset($_POST['it']) && is_numeric($_POST['it']) ? intval($_POST['it']) : 0); @@ -362,7 +362,7 @@ class ZoomSearchController extends AbstractController //Get unique condition on each row (will be needed for row update) $uniqueCondition = Util::getUniqueCondition( $result, - count($this->_columnNames), + count($this->columnNames), $fields_meta, $tmpRow, true @@ -391,18 +391,18 @@ class ZoomSearchController extends AbstractController ]; $column_names_hashes = []; - foreach ($this->_columnNames as $columnName) { + foreach ($this->columnNames as $columnName) { $column_names_hashes[$columnName] = md5($columnName); } $this->render('table/zoom_search/result_form', [ 'db' => $this->db, 'table' => $this->table, - 'column_names' => $this->_columnNames, + 'column_names' => $this->columnNames, 'column_names_hashes' => $column_names_hashes, - 'foreigners' => $this->_foreigners, - 'column_null_flags' => $this->_columnNullFlags, - 'column_types' => $this->_columnTypes, + 'foreigners' => $this->foreigners, + 'column_null_flags' => $this->columnNullFlags, + 'column_types' => $this->columnTypes, 'titles' => $titles, 'goto' => $goto, 'data' => $data, @@ -432,13 +432,13 @@ class ZoomSearchController extends AbstractController ), ]; //Gets column's type and collation - $type = $this->_columnTypes[$column_index]; - $collation = $this->_columnCollations[$column_index]; + $type = $this->columnTypes[$column_index]; + $collation = $this->columnCollations[$column_index]; $cleanType = preg_replace('@\(.*@s', '', $type); //Gets column's comparison operators depending on column type $typeOperators = $this->dbi->types->getTypeOperatorsHtml( $cleanType, - $this->_columnNullFlags[$column_index], + $this->columnNullFlags[$column_index], $selected_operator ); $func = $this->template->render('table/search/column_comparison_operators', [ @@ -447,8 +447,8 @@ class ZoomSearchController extends AbstractController ]); //Gets link to browse foreign data(if any) and criteria inputbox $foreignData = $this->relation->getForeignData( - $this->_foreigners, - $this->_columnNames[$column_index], + $this->foreigners, + $this->columnNames[$column_index], false, '', '' @@ -456,7 +456,7 @@ class ZoomSearchController extends AbstractController $htmlAttributes = ''; if (in_array($cleanType, $this->dbi->types->getIntegerTypes())) { $extractedColumnspec = Util::extractColumnSpec( - $this->_originalColumnTypes[$column_index] + $this->originalColumnTypes[$column_index] ); $is_unsigned = $extractedColumnspec['unsigned']; $minMaxValues = $this->dbi->types->getIntegerRange( @@ -477,9 +477,9 @@ class ZoomSearchController extends AbstractController 'html_attributes' => $htmlAttributes, 'column_id' => 'fieldID_', 'in_zoom_search_edit' => false, - 'foreigners' => $this->_foreigners, - 'column_name' => $this->_columnNames[$column_index], - 'column_name_hash' => md5($this->_columnNames[$column_index]), + 'foreigners' => $this->foreigners, + 'column_name' => $this->columnNames[$column_index], + 'column_name_hash' => md5($this->columnNames[$column_index]), 'foreign_data' => $foreignData, 'table' => $this->table, 'column_index' => $search_index, diff --git a/test/classes/Controllers/Table/RelationControllerTest.php b/test/classes/Controllers/Table/RelationControllerTest.php index f4b2d59429..f74e4f70dc 100644 --- a/test/classes/Controllers/Table/RelationControllerTest.php +++ b/test/classes/Controllers/Table/RelationControllerTest.php @@ -22,7 +22,7 @@ use stdClass; class RelationControllerTest extends AbstractTestCase { /** @var ResponseStub */ - private $_response; + private $response; /** @var Template */ private $template; @@ -84,7 +84,7 @@ class RelationControllerTest extends AbstractTestCase $GLOBALS['dbi'] = $dbi; - $this->_response = new ResponseStub(); + $this->response = new ResponseStub(); $this->template = new Template(); } @@ -116,7 +116,7 @@ class RelationControllerTest extends AbstractTestCase ->will($this->returnValue($tableMock)); $ctrl = new RelationController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -125,7 +125,7 @@ class RelationControllerTest extends AbstractTestCase ); $ctrl->getDropdownValueForTable(); - $json = $this->_response->getJSONResult(); + $json = $this->response->getJSONResult(); $this->assertEquals( $viewColumns, $json['columns'] @@ -156,7 +156,7 @@ class RelationControllerTest extends AbstractTestCase ->will($this->returnValue($tableMock)); $ctrl = new RelationController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -165,7 +165,7 @@ class RelationControllerTest extends AbstractTestCase ); $ctrl->getDropdownValueForTable(); - $json = $this->_response->getJSONResult(); + $json = $this->response->getJSONResult(); $this->assertEquals( $indexedColumns, $json['columns'] @@ -202,7 +202,7 @@ class RelationControllerTest extends AbstractTestCase ); $ctrl = new RelationController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -212,7 +212,7 @@ class RelationControllerTest extends AbstractTestCase $_POST['foreign'] = 'true'; $ctrl->getDropdownValueForDatabase('INNODB'); - $json = $this->_response->getJSONResult(); + $json = $this->response->getJSONResult(); $this->assertEquals( ['table'], $json['tables'] @@ -246,7 +246,7 @@ class RelationControllerTest extends AbstractTestCase ); $ctrl = new RelationController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -256,7 +256,7 @@ class RelationControllerTest extends AbstractTestCase $_POST['foreign'] = 'false'; $ctrl->getDropdownValueForDatabase('INNODB'); - $json = $this->_response->getJSONResult(); + $json = $this->response->getJSONResult(); $this->assertEquals( ['table'], $json['tables'] diff --git a/test/classes/Controllers/Table/SearchControllerTest.php b/test/classes/Controllers/Table/SearchControllerTest.php index 7814d4280b..c4d6543447 100644 --- a/test/classes/Controllers/Table/SearchControllerTest.php +++ b/test/classes/Controllers/Table/SearchControllerTest.php @@ -23,7 +23,7 @@ use stdClass; class SearchControllerTest extends AbstractTestCase { /** @var ResponseStub */ - private $_response; + private $response; /** @var Template */ private $template; @@ -94,7 +94,7 @@ class SearchControllerTest extends AbstractTestCase $GLOBALS['dbi'] = $dbi; $relation->dbi = $dbi; - $this->_response = new ResponseStub(); + $this->response = new ResponseStub(); $this->template = new Template(); } @@ -115,7 +115,7 @@ class SearchControllerTest extends AbstractTestCase ->will($this->returnValue([$expected])); $ctrl = new SearchController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -168,7 +168,7 @@ class SearchControllerTest extends AbstractTestCase ); $ctrl = new SearchController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -186,7 +186,7 @@ class SearchControllerTest extends AbstractTestCase ]; $ctrl->getDataRowAction(); - $json = $this->_response->getJSONResult(); + $json = $this->response->getJSONResult(); $this->assertEquals( $expected, $json['row_info'] diff --git a/test/classes/Controllers/Table/StructureControllerTest.php b/test/classes/Controllers/Table/StructureControllerTest.php index 9c58964454..6a559ab9e7 100644 --- a/test/classes/Controllers/Table/StructureControllerTest.php +++ b/test/classes/Controllers/Table/StructureControllerTest.php @@ -29,7 +29,7 @@ use ReflectionClass; class StructureControllerTest extends AbstractTestCase { /** @var ResponseStub */ - private $_response; + private $response; /** @var Template */ private $template; @@ -62,7 +62,7 @@ class StructureControllerTest extends AbstractTestCase $GLOBALS['dbi'] = $dbi; - $this->_response = new ResponseStub(); + $this->response = new ResponseStub(); $this->template = new Template(); } @@ -84,7 +84,7 @@ class StructureControllerTest extends AbstractTestCase $relation = new Relation($GLOBALS['dbi'], $this->template); $ctrl = new StructureController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -137,7 +137,7 @@ class StructureControllerTest extends AbstractTestCase $relation = new Relation($GLOBALS['dbi'], $this->template); $ctrl = new StructureController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], @@ -168,7 +168,7 @@ class StructureControllerTest extends AbstractTestCase $relation = new Relation($GLOBALS['dbi'], $this->template); $ctrl = new StructureController( - $this->_response, + $this->response, $GLOBALS['dbi'], $this->template, $GLOBALS['db'], diff --git a/test/classes/Stubs/DbiDummy.php b/test/classes/Stubs/DbiDummy.php index 1157fa8e99..ab42b84746 100644 --- a/test/classes/Stubs/DbiDummy.php +++ b/test/classes/Stubs/DbiDummy.php @@ -30,7 +30,7 @@ use function trim; class DbiDummy implements DbiExtension { /** @var array */ - private $_queries = []; + private $queries = []; public const OFFSET_GLOBAL = 1000; @@ -83,13 +83,13 @@ class DbiDummy implements DbiExtension public function realQuery($query, $link = null, $options = 0) { $query = trim(preg_replace('/ */', ' ', str_replace("\n", ' ', $query))); - for ($i = 0, $nb = count($this->_queries); $i < $nb; $i++) { - if ($this->_queries[$i]['query'] != $query) { + for ($i = 0, $nb = count($this->queries); $i < $nb; $i++) { + if ($this->queries[$i]['query'] != $query) { continue; } - $this->_queries[$i]['pos'] = 0; - if (! is_array($this->_queries[$i]['result'])) { + $this->queries[$i]['pos'] = 0; + if (! is_array($this->queries[$i]['result'])) { return false; } @@ -433,7 +433,7 @@ class DbiDummy implements DbiExtension */ public function setResult($query, $result) { - $this->_queries[] = [ + $this->queries[] = [ 'query' => $query, 'result' => $result, ]; @@ -463,7 +463,7 @@ class DbiDummy implements DbiExtension return $GLOBALS['dummy_queries'][$result - self::OFFSET_GLOBAL]; } - return $this->_queries[$result]; + return $this->queries[$result]; } private function init(): void diff --git a/test/classes/Stubs/Response.php b/test/classes/Stubs/Response.php index c4b8d1a9f7..875e9819a6 100644 --- a/test/classes/Stubs/Response.php +++ b/test/classes/Stubs/Response.php @@ -49,7 +49,7 @@ class Response extends \PhpMyAdmin\Response * @access private * @var bool */ - protected $_isSuccess; + protected $isSuccess; /** * Whether we are servicing an ajax request. @@ -57,17 +57,17 @@ class Response extends \PhpMyAdmin\Response * @access private * @var bool */ - private $_isAjax; + private $isAjax; /** * Creates a new class instance */ public function __construct() { - $this->_isSuccess = true; + $this->isSuccess = true; $this->htmlString = ''; $this->json = []; - $this->_isAjax = false; + $this->isAjax = false; $GLOBALS['lang'] = 'en'; $this->header = new Header(); @@ -158,7 +158,7 @@ class Response extends \PhpMyAdmin\Response */ public function setRequestStatus(bool $state): void { - $this->_isSuccess = $state; + $this->isSuccess = $state; } /** @@ -166,7 +166,7 @@ class Response extends \PhpMyAdmin\Response */ public function hasSuccessState(): bool { - return $this->_isSuccess; + return $this->isSuccess; } /** @@ -177,7 +177,7 @@ class Response extends \PhpMyAdmin\Response */ public function clear() { - $this->_isSuccess = true; + $this->isSuccess = true; $this->json = []; $this->htmlString = ''; } @@ -190,7 +190,7 @@ class Response extends \PhpMyAdmin\Response */ public function setAjax(bool $isAjax): void { - $this->_isAjax = (bool) $isAjax; + $this->isAjax = (bool) $isAjax; } /** @@ -199,6 +199,6 @@ class Response extends \PhpMyAdmin\Response */ public function isAjax(): bool { - return $this->_isAjax; + return $this->isAjax; } } diff --git a/test/selenium/CreateRemoveUserTest.php b/test/selenium/CreateRemoveUserTest.php index d6e9e2319e..d628bdce39 100644 --- a/test/selenium/CreateRemoveUserTest.php +++ b/test/selenium/CreateRemoveUserTest.php @@ -27,7 +27,7 @@ class CreateRemoveUserTest extends TestBase * @access private * @var string */ - private $_txtUsername; + private $txtUsername; /** * Password for the user @@ -35,7 +35,7 @@ class CreateRemoveUserTest extends TestBase * @access private * @var string */ - private $_txtPassword; + private $txtPassword; /** * Setup the browser environment to run the selenium test case @@ -44,8 +44,8 @@ class CreateRemoveUserTest extends TestBase { parent::setUp(); $this->skipIfNotSuperUser(); - $this->_txtUsername = 'pma_user'; - $this->_txtPassword = 'abc_123'; + $this->txtUsername = 'pma_user'; + $this->txtPassword = 'abc_123'; $this->login(); } @@ -69,7 +69,7 @@ class CreateRemoveUserTest extends TestBase $this->waitAjax(); $userField = $this->waitForElement('name', 'username'); - $userField->sendKeys($this->_txtUsername); + $userField->sendKeys($this->txtUsername); $this->selectByLabel($this->byId('select_pred_hostname'), 'Local'); @@ -81,8 +81,8 @@ class CreateRemoveUserTest extends TestBase $this->assertNotEquals('', $this->byId('text_pma_pw2')->getAttribute('value')); $this->assertNotEquals('', $this->byId('generated_pw')->getAttribute('value')); - $this->byId('text_pma_pw')->sendKeys($this->_txtPassword); - $this->byId('text_pma_pw2')->sendKeys($this->_txtPassword); + $this->byId('text_pma_pw')->sendKeys($this->txtPassword); + $this->byId('text_pma_pw2')->sendKeys($this->txtPassword); // Make sure the element is visible before clicking $this->scrollIntoView('createdb-1'); @@ -101,7 +101,7 @@ class CreateRemoveUserTest extends TestBase // Removing the newly added user $this->waitForElement('partialLinkText', 'User accounts')->click(); $this->waitForElement('id', 'usersForm'); - $temp = $this->_txtUsername . '&#27;localhost'; + $temp = $this->txtUsername . '&#27;localhost'; $this->byXPath( "(//input[@name='selected_usr[]'])[@value='" . $temp . "']"