From 5bbac35ed1ce873f9e78dcbadf28b763afe4e9d1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 26 Sep 2016 15:40:07 -0700 Subject: [PATCH] Replace DatabaseBase:: with Database:: and update type hints Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511 --- includes/MergeHistory.php | 2 +- includes/WatchedItemQueryService.php | 20 +++++------ includes/WatchedItemStore.php | 2 +- includes/cache/LinkBatch.php | 2 +- includes/changes/ChangesFeed.php | 4 +-- includes/changetags/ChangeTags.php | 8 ++--- includes/dao/DBAccessBase.php | 4 +-- includes/db/DatabaseMssql.php | 8 ++--- includes/filerepo/ForeignDBRepo.php | 2 +- includes/filerepo/file/LocalFile.php | 2 +- includes/installer/DatabaseUpdater.php | 4 +-- includes/installer/MssqlInstaller.php | 8 ++--- includes/installer/MysqlInstaller.php | 10 +++--- includes/installer/PostgresInstaller.php | 6 ++-- includes/installer/SqliteInstaller.php | 4 +-- includes/libs/lockmanager/DBLockManager.php | 2 +- includes/libs/rdbms/TransactionProfiler.php | 2 +- includes/libs/rdbms/database/Database.php | 34 +++++++++--------- .../libs/rdbms/database/DatabaseSqlite.php | 2 +- includes/libs/rdbms/database/IDatabase.php | 12 +++---- includes/libs/rdbms/encasing/LikeMatch.php | 4 +-- .../libs/rdbms/exception/DBQueryError.php | 2 +- .../libs/rdbms/loadbalancer/LoadBalancer.php | 8 ++--- includes/objectcache/SqlBagOStuff.php | 2 +- includes/page/WikiPage.php | 2 +- includes/user/User.php | 8 ++--- tests/parser/ParserTestRunner.php | 2 +- tests/phpunit/MediaWikiTestCase.php | 22 ++++++------ .../WatchedItemQueryServiceUnitTest.php | 4 +-- .../includes/db/DatabaseMysqlBaseTest.php | 3 +- tests/phpunit/includes/db/DatabaseSQLTest.php | 36 +++++++++---------- .../includes/db/DatabaseSqliteTest.php | 2 +- tests/phpunit/includes/db/DatabaseTest.php | 20 +++++------ .../includes/db/DatabaseTestHelper.php | 8 ++--- tests/phpunit/includes/db/LBFactoryTest.php | 4 +-- .../installer/DatabaseUpdaterTest.php | 6 ++-- .../includes/utils/BatchRowUpdateTest.php | 9 +++-- 37 files changed, 139 insertions(+), 141 deletions(-) diff --git a/includes/MergeHistory.php b/includes/MergeHistory.php index dd1fd37051..f797fe355c 100644 --- a/includes/MergeHistory.php +++ b/includes/MergeHistory.php @@ -42,7 +42,7 @@ class MergeHistory { /** @var Title Page to which history will be merged */ protected $dest; - /** @var DatabaseBase Database that we are using */ + /** @var IDatabase Database that we are using */ protected $dbw; /** @var MWTimestamp Maximum timestamp that we can use (oldest timestamp of dest) */ diff --git a/includes/WatchedItemQueryService.php b/includes/WatchedItemQueryService.php index 4ac4deaa0a..c040fb1c29 100644 --- a/includes/WatchedItemQueryService.php +++ b/includes/WatchedItemQueryService.php @@ -63,10 +63,10 @@ class WatchedItemQueryService { } /** - * @param DatabaseBase $connection + * @param Database $connection * @throws MWException */ - private function reuseConnection( DatabaseBase $connection ) { + private function reuseConnection( Database $connection ) { $this->loadBalancer->reuseConnection( $connection ); } @@ -337,7 +337,7 @@ class WatchedItemQueryService { } private function getWatchedItemsWithRCInfoQueryConds( - DatabaseBase $db, + Database $db, User $user, array $options ) { @@ -445,7 +445,7 @@ class WatchedItemQueryService { return $conds; } - private function getStartEndConds( DatabaseBase $db, array $options ) { + private function getStartEndConds( Database $db, array $options ) { if ( !isset( $options['start'] ) && ! isset( $options['end'] ) ) { return []; } @@ -464,7 +464,7 @@ class WatchedItemQueryService { return $conds; } - private function getUserRelatedConds( DatabaseBase $db, User $user, array $options ) { + private function getUserRelatedConds( Database $db, User $user, array $options ) { if ( !array_key_exists( 'onlyByUser', $options ) && !array_key_exists( 'notByUser', $options ) ) { return []; } @@ -491,7 +491,7 @@ class WatchedItemQueryService { return $conds; } - private function getExtraDeletedPageLogEntryRelatedCond( DatabaseBase $db, User $user ) { + private function getExtraDeletedPageLogEntryRelatedCond( Database $db, User $user ) { // LogPage::DELETED_ACTION hides the affected page, too. So hide those // entirely from the watchlist, or someone could guess the title. $bitmask = 0; @@ -509,7 +509,7 @@ class WatchedItemQueryService { return ''; } - private function getStartFromConds( DatabaseBase $db, array $options ) { + private function getStartFromConds( Database $db, array $options ) { $op = $options['dir'] === self::DIR_OLDER ? '<' : '>'; list( $rcTimestamp, $rcId ) = $options['startFrom']; $rcTimestamp = $db->addQuotes( $db->timestamp( $rcTimestamp ) ); @@ -529,7 +529,7 @@ class WatchedItemQueryService { ); } - private function getWatchedItemsForUserQueryConds( DatabaseBase $db, User $user, array $options ) { + private function getWatchedItemsForUserQueryConds( Database $db, User $user, array $options ) { $conds = [ 'wl_user' => $user->getId() ]; if ( $options['namespaceIds'] ) { $conds['wl_namespace'] = array_map( 'intval', $options['namespaceIds'] ); @@ -563,12 +563,12 @@ class WatchedItemQueryService { * Creates a query condition part for getting only items before or after the given link target * (while ordering using $sort mode) * - * @param DatabaseBase $db + * @param Database $db * @param LinkTarget $target * @param string $op comparison operator to use in the conditions * @return string */ - private function getFromUntilTargetConds( DatabaseBase $db, LinkTarget $target, $op ) { + private function getFromUntilTargetConds( Database $db, LinkTarget $target, $op ) { return $db->makeList( [ "wl_namespace $op " . $target->getNamespace(), diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php index 9a74401a43..478cc5fbc2 100644 --- a/includes/WatchedItemStore.php +++ b/includes/WatchedItemStore.php @@ -200,7 +200,7 @@ class WatchedItemStore implements StatsdAwareInterface { } /** - * @param DatabaseBase $connection + * @param Database $connection * * @throws MWException */ diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 8a4d061e95..d773fff3b7 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -236,7 +236,7 @@ class LinkBatch { * Construct a WHERE clause which will match all the given titles. * * @param string $prefix The appropriate table's field name prefix ('page', 'pl', etc) - * @param IDatabase $db DatabaseBase object to use + * @param IDatabase $db DB object to use * @return string|bool String with SQL where clause fragment, or false if no items. */ public function constructSet( $prefix, $db ) { diff --git a/includes/changes/ChangesFeed.php b/includes/changes/ChangesFeed.php index ca6ba48b36..15a00c7036 100644 --- a/includes/changes/ChangesFeed.php +++ b/includes/changes/ChangesFeed.php @@ -164,7 +164,7 @@ class ChangesFeed { /** * Generate the feed items given a row from the database, printing the feed. - * @param object $rows DatabaseBase resource with recentchanges rows + * @param object $rows IDatabase resource with recentchanges rows * @param ChannelFeed $feed */ public static function generateFeed( $rows, &$feed ) { @@ -178,7 +178,7 @@ class ChangesFeed { /** * Generate the feed items given a row from the database. - * @param object $rows DatabaseBase resource with recentchanges rows + * @param object $rows IDatabase resource with recentchanges rows * @return array */ public static function buildItems( $rows ) { diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 6455a3a980..955e9725b6 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -608,10 +608,10 @@ class ChangeTags { * Handles selecting tags, and filtering. * Needs $tables to be set up properly, so we can figure out which join conditions to use. * - * @param string|array $tables Table names, see DatabaseBase::select - * @param string|array $fields Fields used in query, see DatabaseBase::select - * @param string|array $conds Conditions used in query, see DatabaseBase::select - * @param array $join_conds Join conditions, see DatabaseBase::select + * @param string|array $tables Table names, see Database::select + * @param string|array $fields Fields used in query, see Database::select + * @param string|array $conds Conditions used in query, see Database::select + * @param array $join_conds Join conditions, see Database::select * @param array $options Options, see Database::select * @param bool|string $filter_tag Tag to select on * diff --git a/includes/dao/DBAccessBase.php b/includes/dao/DBAccessBase.php index 01814c1022..ed617fe061 100644 --- a/includes/dao/DBAccessBase.php +++ b/includes/dao/DBAccessBase.php @@ -68,9 +68,9 @@ abstract class DBAccessBase implements IDBAccessObject { * * @since 1.21 * - * @param DatabaseBase $db The database connection to release. + * @param Database $db The database connection to release. */ - protected function releaseConnection( DatabaseBase $db ) { + protected function releaseConnection( Database $db ) { if ( $this->wiki !== false ) { $loadBalancer = $this->getLoadBalancer(); $loadBalancer->reuseConnection( $db ); diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index eb061d85fe..45ea54c3bc 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -737,15 +737,15 @@ class DatabaseMssql extends DatabaseBase { * UPDATE wrapper. Takes a condition array and a SET array. * * @param string $table Name of the table to UPDATE. This will be passed through - * DatabaseBase::tableName(). + * Database::tableName(). * * @param array $values An array of values to SET. For each array element, * the key gives the field name, and the value gives the data * to set that field to. The data will be quoted by - * DatabaseBase::addQuotes(). + * Database::addQuotes(). * * @param array $conds An array of conditions (WHERE). See - * DatabaseBase::select() for the details of the format of + * Database::select() for the details of the format of * condition arrays. Use '*' to update all rows. * * @param string $fname The function name of the caller (from __METHOD__), @@ -786,7 +786,7 @@ class DatabaseMssql extends DatabaseBase { * @param int $mode Constant * - LIST_COMMA: comma separated, no field names * - LIST_AND: ANDed WHERE clause (without the WHERE). See - * the documentation for $conds in DatabaseBase::select(). + * the documentation for $conds in Database::select(). * - LIST_OR: ORed WHERE clause (without the WHERE) * - LIST_SET: comma separated with field names, like a SET clause * - LIST_NAMES: comma separated field names diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 001800f3ba..be046bd8be 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -106,7 +106,7 @@ class ForeignDBRepo extends LocalRepo { ]; return function ( $index ) use ( $type, $params ) { - return DatabaseBase::factory( $type, $params ); + return Database::factory( $type, $params ); }; } diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 60cfdac271..7ffb147c70 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -2852,7 +2852,7 @@ class LocalFileMoveBatch { protected $archive; - /** @var DatabaseBase */ + /** @var IDatabase */ protected $db; /** diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 2425005ff8..fbdc9342ad 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -101,11 +101,11 @@ abstract class DatabaseUpdater { /** * Constructor * - * @param DatabaseBase $db To perform updates on + * @param Database $db To perform updates on * @param bool $shared Whether to perform updates on shared tables * @param Maintenance $maintenance Maintenance object which created us */ - protected function __construct( DatabaseBase &$db, $shared, Maintenance $maintenance = null ) { + protected function __construct( Database &$db, $shared, Maintenance $maintenance = null ) { $this->db = $db; $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files $this->shared = $shared; diff --git a/includes/installer/MssqlInstaller.php b/includes/installer/MssqlInstaller.php index 62cd8838ac..739be820c0 100644 --- a/includes/installer/MssqlInstaller.php +++ b/includes/installer/MssqlInstaller.php @@ -212,7 +212,7 @@ class MssqlInstaller extends DatabaseInstaller { } try { - $db = DatabaseBase::factory( 'mssql', [ + $db = Database::factory( 'mssql', [ 'host' => $this->getVar( 'wgDBserver' ), 'user' => $user, 'password' => $password, @@ -261,7 +261,7 @@ class MssqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return false; } - /** @var $conn DatabaseBase */ + /** @var $conn Database */ $conn = $status->value; // We need the server-level ALTER ANY LOGIN permission to create new accounts @@ -457,7 +457,7 @@ class MssqlInstaller extends DatabaseInstaller { } try { - DatabaseBase::factory( 'mssql', [ + Database::factory( 'mssql', [ 'host' => $this->getVar( 'wgDBserver' ), 'user' => $user, 'password' => $password, @@ -491,7 +491,7 @@ class MssqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } - /** @var DatabaseBase $conn */ + /** @var Database $conn */ $conn = $status->value; $dbName = $this->getVar( 'wgDBname' ); $schemaName = $this->getVar( 'wgDBmwschema' ); diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 1bd3f51de2..812742c6d0 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -143,7 +143,7 @@ class MysqlInstaller extends DatabaseInstaller { public function openConnection() { $status = Status::newGood(); try { - $db = DatabaseBase::factory( 'mysql', [ + $db = Database::factory( 'mysql', [ 'host' => $this->getVar( 'wgDBserver' ), 'user' => $this->getVar( '_InstallUser' ), 'password' => $this->getVar( '_InstallPassword' ), @@ -261,7 +261,7 @@ class MysqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return false; } - /** @var $conn DatabaseBase */ + /** @var $conn Database */ $conn = $status->value; // Get current account name @@ -427,7 +427,7 @@ class MysqlInstaller extends DatabaseInstaller { if ( !$create ) { // Test the web account try { - DatabaseBase::factory( 'mysql', [ + Database::factory( 'mysql', [ 'host' => $this->getVar( 'wgDBserver' ), 'user' => $this->getVar( 'wgDBuser' ), 'password' => $this->getVar( 'wgDBpassword' ), @@ -471,7 +471,7 @@ class MysqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } - /** @var DatabaseBase $conn */ + /** @var Database $conn */ $conn = $status->value; $dbName = $this->getVar( 'wgDBname' ); if ( !$conn->selectDB( $dbName ) ) { @@ -509,7 +509,7 @@ class MysqlInstaller extends DatabaseInstaller { if ( $this->getVar( '_CreateDBAccount' ) ) { // Before we blindly try to create a user that already has access, try { // first attempt to connect to the database - DatabaseBase::factory( 'mysql', [ + Database::factory( 'mysql', [ 'host' => $server, 'user' => $dbUser, 'password' => $password, diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 07284154dd..7a2794d0a4 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -154,7 +154,7 @@ class PostgresInstaller extends DatabaseInstaller { protected function openConnectionWithParams( $user, $password, $dbName, $schema ) { $status = Status::newGood(); try { - $db = DatabaseBase::factory( 'postgres', [ + $db = Database::factory( 'postgres', [ 'host' => $this->getVar( 'wgDBserver' ), 'user' => $user, 'password' => $password, @@ -264,7 +264,7 @@ class PostgresInstaller extends DatabaseInstaller { 'password' => $password, 'dbname' => $db ]; - $conn = DatabaseBase::factory( 'postgres', $p ); + $conn = Database::factory( 'postgres', $p ); } catch ( DBConnectionError $error ) { $conn = false; $status->fatal( 'config-pg-test-error', $db, @@ -413,7 +413,7 @@ class PostgresInstaller extends DatabaseInstaller { /** * Recursive helper for canCreateObjectsForWebUser(). - * @param DatabaseBase $conn + * @param Database $conn * @param int $targetMember Role ID of the member to look for * @param int $group Role ID of the group to look for * @param int $maxDepth Maximum recursive search depth diff --git a/includes/installer/SqliteInstaller.php b/includes/installer/SqliteInstaller.php index 0adeddfa4b..c5c4a7cc14 100644 --- a/includes/installer/SqliteInstaller.php +++ b/includes/installer/SqliteInstaller.php @@ -184,7 +184,7 @@ class SqliteInstaller extends DatabaseInstaller { $dbName = $this->getVar( 'wgDBname' ); try { # @todo FIXME: Need more sensible constructor parameters, e.g. single associative array - $db = DatabaseBase::factory( 'sqlite', [ 'dbname' => $dbName, 'dbDirectory' => $dir ] ); + $db = Database::factory( 'sqlite', [ 'dbname' => $dbName, 'dbDirectory' => $dir ] ); $status->value = $db; } catch ( DBConnectionError $e ) { $status->fatal( 'config-sqlite-connection-error', $e->getMessage() ); @@ -239,7 +239,7 @@ class SqliteInstaller extends DatabaseInstaller { # Create the global cache DB try { - $conn = DatabaseBase::factory( 'sqlite', [ 'dbname' => 'wikicache', 'dbDirectory' => $dir ] ); + $conn = Database::factory( 'sqlite', [ 'dbname' => 'wikicache', 'dbDirectory' => $dir ] ); # @todo: don't duplicate objectcache definition, though it's very simple $sql = <<dbServers[$lockDb] ) ) { // Parameters to construct a new database connection $config = $this->dbServers[$lockDb]; - $db = DatabaseBase::factory( $config['type'], $config ); + $db = Database::factory( $config['type'], $config ); } else { throw new UnexpectedValueException( "No server called '$lockDb'." ); } diff --git a/includes/libs/rdbms/TransactionProfiler.php b/includes/libs/rdbms/TransactionProfiler.php index 5c9976d1bf..4d2b28fdd5 100644 --- a/includes/libs/rdbms/TransactionProfiler.php +++ b/includes/libs/rdbms/TransactionProfiler.php @@ -29,7 +29,7 @@ use Psr\Log\NullLogger; /** * Helper class that detects high-contention DB queries via profiling calls * - * This class is meant to work with a DatabaseBase object, which manages queries + * This class is meant to work with an IDatabase object, which manages queries * * @since 1.24 */ diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 897e55f915..2b058e991d 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -128,7 +128,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * Either a short hexidecimal string if a transaction is active or "" * * @var string - * @see DatabaseBase::mTrxLevel + * @see Database::mTrxLevel */ protected $mTrxShortId = ''; /** @@ -137,7 +137,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * point (possibly more up-to-date since the first SELECT defines the snapshot). * * @var float|null - * @see DatabaseBase::mTrxLevel + * @see Database::mTrxLevel */ private $mTrxTimestamp = null; /** @var float Lag estimate at the time of BEGIN */ @@ -147,21 +147,21 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * Used to provide additional context for error reporting. * * @var string - * @see DatabaseBase::mTrxLevel + * @see Database::mTrxLevel */ private $mTrxFname = null; /** * Record if possible write queries were done in the last transaction started * * @var bool - * @see DatabaseBase::mTrxLevel + * @see Database::mTrxLevel */ private $mTrxDoneWrites = false; /** * Record if the current transaction was started implicitly due to DBO_TRX being set. * * @var bool - * @see DatabaseBase::mTrxLevel + * @see Database::mTrxLevel */ private $mTrxAutomatic = false; /** @@ -171,7 +171,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware */ private $mTrxAtomicLevels = []; /** - * Record if the current transaction was started implicitly by DatabaseBase::startAtomic + * Record if the current transaction was started implicitly by Database::startAtomic * * @var bool */ @@ -1101,7 +1101,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * @param array $options Associative array of options to be turned into * an SQL query, valid keys are listed in the function. * @return array - * @see DatabaseBase::select() + * @see Database::select() */ protected function makeSelectOptions( $options ) { $preLimitTail = $postLimitTail = ''; @@ -1189,7 +1189,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * * @param array $options Associative array of options * @return string - * @see DatabaseBase::select() + * @see Database::select() * @since 1.21 */ protected function makeGroupByWithHaving( $options ) { @@ -1215,7 +1215,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * * @param array $options Associative array of options * @return string - * @see DatabaseBase::select() + * @see Database::select() * @since 1.21 */ protected function makeOrderBy( $options ) { @@ -1420,7 +1420,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware } /** - * Helper for DatabaseBase::insert(). + * Helper for Database::insert(). * * @param array $options * @return string @@ -1482,7 +1482,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware } /** - * Make UPDATE options array for DatabaseBase::makeUpdateOptions + * Make UPDATE options array for Database::makeUpdateOptions * * @param array $options * @return array @@ -1502,9 +1502,9 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware } /** - * Make UPDATE options for the DatabaseBase::update function + * Make UPDATE options for the Database::update function * - * @param array $options The options passed to DatabaseBase::update + * @param array $options The options passed to Database::update * @return string */ protected function makeUpdateOptions( $options ) { @@ -2701,7 +2701,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware /** * Issues the BEGIN command to the database server. * - * @see DatabaseBase::begin() + * @see Database::begin() * @param string $fname */ protected function doBegin( $fname ) { @@ -2760,7 +2760,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware /** * Issues the COMMIT command to the database server. * - * @see DatabaseBase::commit() + * @see Database::commit() * @param string $fname */ protected function doCommit( $fname ) { @@ -2807,7 +2807,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware /** * Issues the ROLLBACK command to the database server. * - * @see DatabaseBase::rollback() + * @see Database::rollback() * @param string $fname */ protected function doRollback( $fname ) { @@ -2884,7 +2884,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware * necessary. Boolean values are passed through as is, to indicate success * of write queries or failure. * - * Once upon a time, DatabaseBase::query() returned a bare MySQL result + * Once upon a time, Database::query() returned a bare MySQL result * resource, and it was necessary to call this function to convert it to * a wrapper. Nowadays, raw database objects are never exposed to external * callers, so this is unnecessary in external code. diff --git a/includes/libs/rdbms/database/DatabaseSqlite.php b/includes/libs/rdbms/database/DatabaseSqlite.php index c33d3b3587..156e5252b3 100644 --- a/includes/libs/rdbms/database/DatabaseSqlite.php +++ b/includes/libs/rdbms/database/DatabaseSqlite.php @@ -117,7 +117,7 @@ class DatabaseSqlite extends DatabaseBase { $p['schema'] = false; $p['tablePrefix'] = ''; - return DatabaseBase::factory( 'sqlite', $p ); + return Database::factory( 'sqlite', $p ); } /** diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index 0396ec8530..c32a7ff561 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -613,7 +613,7 @@ interface IDatabase { * for use in field names (e.g. a.user_name). * * All of the table names given here are automatically run through - * DatabaseBase::tableName(), which causes the table prefix (if any) to be + * Database::tableName(), which causes the table prefix (if any) to be * added, and various other table name mappings to be performed. * * Do not use untrusted user input as a table name. Alias names should @@ -895,7 +895,7 @@ interface IDatabase { * IDatabase::affectedRows(). * * @param string $table Table name. This will be passed through - * DatabaseBase::tableName(). + * Database::tableName(). * @param array $a Array of rows to insert * @param string $fname Calling function name (use __METHOD__) for logs/profiling * @param array $options Array of options @@ -908,7 +908,7 @@ interface IDatabase { * UPDATE wrapper. Takes a condition array and a SET array. * * @param string $table Name of the table to UPDATE. This will be passed through - * DatabaseBase::tableName(). + * Database::tableName(). * @param array $values An array of values to SET. For each array element, * the key gives the field name, and the value gives the data to set * that field to. The data will be quoted by IDatabase::addQuotes(). @@ -1149,7 +1149,7 @@ interface IDatabase { * * @since 1.22 * - * @param string $table Table name. This will be passed through DatabaseBase::tableName(). + * @param string $table Table name. This will be passed through Database::tableName(). * @param array $rows A single row or list of rows to insert * @param array $uniqueIndexes List of single field names or field name tuples * @param array $set An array of values to SET. For each array element, the @@ -1463,8 +1463,8 @@ interface IDatabase { * * This can be an alternative to explicit startAtomic()/endAtomic() calls. * - * @see DatabaseBase::startAtomic - * @see DatabaseBase::endAtomic + * @see Database::startAtomic + * @see Database::endAtomic * * @param string $fname Caller name (usually __METHOD__) * @param callable $callback Callback that issues DB updates diff --git a/includes/libs/rdbms/encasing/LikeMatch.php b/includes/libs/rdbms/encasing/LikeMatch.php index 5dee884f28..b0b3c87984 100644 --- a/includes/libs/rdbms/encasing/LikeMatch.php +++ b/includes/libs/rdbms/encasing/LikeMatch.php @@ -1,8 +1,8 @@ wasConnectionError( $errno ) ) { + if ( $db instanceof Database && $db->wasConnectionError( $errno ) ) { $message = "A connection error occured. \n" . "Query: $sql\n" . "Function: $fname\n" . diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 36e4c6c662..a60e741cee 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -1024,7 +1024,7 @@ class LoadBalancer implements ILoadBalancer { } public function finalizeMasterChanges() { - $this->forEachOpenMasterConnection( function ( DatabaseBase $conn ) { + $this->forEachOpenMasterConnection( function ( Database $conn ) { // Any error should cause all DB transactions to be rolled back together $conn->setTrxEndCallbackSuppression( false ); $conn->runOnTransactionPreCommitCallbacks(); @@ -1077,7 +1077,7 @@ class LoadBalancer implements ILoadBalancer { $failures = []; $this->forEachOpenMasterConnection( - function ( DatabaseBase $conn ) use ( $fname, &$failures ) { + function ( Database $conn ) use ( $fname, &$failures ) { $conn->setTrxEndCallbackSuppression( true ); try { $conn->flushSnapshot( $fname ); @@ -1131,7 +1131,7 @@ class LoadBalancer implements ILoadBalancer { public function runMasterPostTrxCallbacks( $type ) { $e = null; // first exception - $this->forEachOpenMasterConnection( function ( DatabaseBase $conn ) use ( $type, &$e ) { + $this->forEachOpenMasterConnection( function ( Database $conn ) use ( $type, &$e ) { $conn->setTrxEndCallbackSuppression( false ); if ( $conn->writesOrCallbacksPending() ) { // This happens if onTransactionIdle() callbacks leave callbacks on *another* DB @@ -1178,7 +1178,7 @@ class LoadBalancer implements ILoadBalancer { } public function suppressTransactionEndCallbacks() { - $this->forEachOpenMasterConnection( function ( DatabaseBase $conn ) { + $this->forEachOpenMasterConnection( function ( Database $conn ) { $conn->setTrxEndCallbackSuppression( true ); } ); } diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index d06213f1be..47dae78850 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -182,7 +182,7 @@ class SqlBagOStuff extends BagOStuff { $this->logger->debug( __CLASS__ . ": connecting to $host" ); // Use a blank trx profiler to ignore expections as this is a cache $info['trxProfiler'] = new TransactionProfiler(); - $db = DatabaseBase::factory( $type, $info ); + $db = Database::factory( $type, $info ); $db->clearFlag( DBO_TRX ); } else { $index = $this->replicaOnly ? DB_REPLICA : DB_MASTER; diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 50c5030f5e..41e9e4f705 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -3502,7 +3502,7 @@ class WikiPage implements Page, IDBAccessObject { $dbr = wfGetDB( DB_REPLICA ); $res = $dbr->select( 'categorylinks', [ 'cl_to AS page_title, ' . NS_CATEGORY . ' AS page_namespace' ], - // Have to do that since DatabaseBase::fieldNamesWithAlias treats numeric indexes + // Have to do that since Database::fieldNamesWithAlias treats numeric indexes // as not being aliases, and NS_CATEGORY is numeric [ 'cl_from' => $id ], __METHOD__ ); diff --git a/includes/user/User.php b/includes/user/User.php index 0d06c7bac4..6083db97e3 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1434,11 +1434,11 @@ class User implements IDBAccessObject { * protected against race conditions using a compare-and-set (CAS) mechanism * based on comparing $this->mTouched with the user_touched field. * - * @param DatabaseBase $db - * @param array $conditions WHERE conditions for use with DatabaseBase::update - * @return array WHERE conditions for use with DatabaseBase::update + * @param Database $db + * @param array $conditions WHERE conditions for use with Database::update + * @return array WHERE conditions for use with Database::update */ - protected function makeUpdateConditions( DatabaseBase $db, array $conditions ) { + protected function makeUpdateConditions( Database $db, array $conditions ) { if ( $this->mTouched ) { // CAS check: only update if the row wasn't changed sicne it was loaded. $conditions['user_touched'] = $db->timestamp( $this->mTouched ); diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index d2968a123b..369cd0e8c8 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -49,7 +49,7 @@ class ParserTestRunner { /** * Our connection to the database - * @var DatabaseBase + * @var Database */ private $db; diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index c95222976e..45a7ce5f59 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -42,7 +42,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * Primary database * - * @var DatabaseBase + * @var Database * @since 1.18 */ protected $db; @@ -1070,11 +1070,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * Clones all tables in the given database (whatever database that connection has * open), to versions with the test prefix. * - * @param DatabaseBase $db Database to use + * @param Database $db Database to use * @param string $prefix Prefix to use for test tables * @return bool True if tables were cloned, false if only the prefix was changed */ - protected static function setupDatabaseWithTestPrefix( DatabaseBase $db, $prefix ) { + protected static function setupDatabaseWithTestPrefix( Database $db, $prefix ) { $tablesCloned = self::listTables( $db ); $dbClone = new CloneDatabase( $db, $tablesCloned, $prefix ); $dbClone->useTemporaryTables( self::$useTemporaryTables ); @@ -1123,12 +1123,12 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * @note this method only works when first called. Subsequent calls have no effect, * even if using different parameters. * - * @param DatabaseBase $db The database connection + * @param Database $db The database connection * @param string $prefix The prefix to use for the new table set (aka schema). * * @throws MWException If the database table prefix is already $prefix */ - public static function setupTestDB( DatabaseBase $db, $prefix ) { + public static function setupTestDB( Database $db, $prefix ) { if ( self::$dbSetup ) { return; } @@ -1139,7 +1139,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { } // TODO: the below should be re-written as soon as LBFactory, LoadBalancer, - // and DatabaseBase no longer use global state. + // and Database no longer use global state. self::$dbSetup = true; @@ -1178,7 +1178,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * Gets master database connections for all of the ExternalStoreDB * stores configured in $wgDefaultExternalStore. * - * @return DatabaseBase[] Array of DatabaseBase master connections + * @return Database[] Array of Database master connections */ protected static function getExternalStoreDatabaseConnections() { @@ -1192,7 +1192,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( strpos( $url, 'DB://' ) === 0 ) { list( $proto, $cluster ) = explode( '://', $url, 2 ); // Avoid getMaster() because setupDatabaseWithTestPrefix() - // requires DatabaseBase instead of plain DBConnRef/IDatabase + // requires Database instead of plain DBConnRef/IDatabase $lb = $externalStoreDB->getLoadBalancer( $cluster ); $dbw = $lb->getConnection( DB_MASTER ); $dbws[] = $dbw; @@ -1226,7 +1226,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * Empty all tables so they can be repopulated for tests * - * @param DatabaseBase $db|null Database to reset + * @param Database $db|null Database to reset * @param array $tablesUsed Tables to reset */ private function resetDB( $db, $tablesUsed ) { @@ -1309,11 +1309,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * @since 1.18 * - * @param DatabaseBase $db + * @param Database $db * * @return array */ - public static function listTables( DatabaseBase $db ) { + public static function listTables( Database $db ) { $prefix = $db->tablePrefix(); $tables = $db->listTables( $prefix, __METHOD__ ); diff --git a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php index 1d232fee8e..93e0b57f7a 100644 --- a/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php +++ b/tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php @@ -6,10 +6,10 @@ class WatchedItemQueryServiceUnitTest extends PHPUnit_Framework_TestCase { /** - * @return PHPUnit_Framework_MockObject_MockObject|DatabaseBase + * @return PHPUnit_Framework_MockObject_MockObject|Database */ private function getMockDb() { - $mock = $this->getMockBuilder( DatabaseBase::class ) + $mock = $this->getMockBuilder( Database::class ) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php b/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php index c014e84b0a..dbb126f300 100644 --- a/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php +++ b/tests/phpunit/includes/db/DatabaseMysqlBaseTest.php @@ -29,7 +29,7 @@ * Fake class around abstract class so we can call concrete methods. */ class FakeDatabaseMysqlBase extends DatabaseMysqlBase { - // From DatabaseBase + // From Database function __construct() { $this->profiler = new ProfilerStub( [] ); $this->trxProfiler = new TransactionProfiler(); @@ -89,7 +89,6 @@ class FakeDatabaseMysqlBase extends DatabaseMysqlBase { } - // From interface DatabaseType function insertId() { } diff --git a/tests/phpunit/includes/db/DatabaseSQLTest.php b/tests/phpunit/includes/db/DatabaseSQLTest.php index 68bc964e8c..656e661690 100644 --- a/tests/phpunit/includes/db/DatabaseSQLTest.php +++ b/tests/phpunit/includes/db/DatabaseSQLTest.php @@ -26,7 +26,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideSelect - * @covers DatabaseBase::select + * @covers Database::select */ public function testSelect( $sql, $sqlText ) { $this->database->select( @@ -132,7 +132,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideUpdate - * @covers DatabaseBase::update + * @covers Database::update */ public function testUpdate( $sql, $sqlText ) { $this->database->update( @@ -184,7 +184,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideDelete - * @covers DatabaseBase::delete + * @covers Database::delete */ public function testDelete( $sql, $sqlText ) { $this->database->delete( @@ -217,7 +217,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideUpsert - * @covers DatabaseBase::upsert + * @covers Database::upsert */ public function testUpsert( $sql, $sqlText ) { $this->database->upsert( @@ -253,7 +253,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideDeleteJoin - * @covers DatabaseBase::deleteJoin + * @covers Database::deleteJoin */ public function testDeleteJoin( $sql, $sqlText ) { $this->database->deleteJoin( @@ -300,7 +300,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideInsert - * @covers DatabaseBase::insert + * @covers Database::insert */ public function testInsert( $sql, $sqlText ) { $this->database->insert( @@ -353,7 +353,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideInsertSelect - * @covers DatabaseBase::insertSelect + * @covers Database::insertSelect */ public function testInsertSelect( $sql, $sqlTextNative, $sqlSelect, $sqlInsert ) { $this->database->insertSelect( @@ -440,7 +440,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideReplace - * @covers DatabaseBase::replace + * @covers Database::replace */ public function testReplace( $sql, $sqlText ) { $this->database->replace( @@ -555,7 +555,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideNativeReplace - * @covers DatabaseBase::nativeReplace + * @covers Database::nativeReplace */ public function testNativeReplace( $sql, $sqlText ) { $this->database->nativeReplace( @@ -582,7 +582,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideConditional - * @covers DatabaseBase::conditional + * @covers Database::conditional */ public function testConditional( $sql, $sqlText ) { $this->assertEquals( trim( $this->database->conditional( @@ -623,7 +623,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideBuildConcat - * @covers DatabaseBase::buildConcat + * @covers Database::buildConcat */ public function testBuildConcat( $stringList, $sqlText ) { $this->assertEquals( trim( $this->database->buildConcat( @@ -646,7 +646,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideBuildLike - * @covers DatabaseBase::buildLike + * @covers Database::buildLike */ public function testBuildLike( $array, $sqlText ) { $this->assertEquals( trim( $this->database->buildLike( @@ -677,7 +677,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideUnionQueries - * @covers DatabaseBase::unionQueries + * @covers Database::unionQueries */ public function testUnionQueries( $sql, $sqlText ) { $this->assertEquals( trim( $this->database->unionQueries( @@ -713,7 +713,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::commit + * @covers Database::commit */ public function testTransactionCommit() { $this->database->begin( __METHOD__ ); @@ -722,7 +722,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::rollback + * @covers Database::rollback */ public function testTransactionRollback() { $this->database->begin( __METHOD__ ); @@ -731,7 +731,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::dropTable + * @covers Database::dropTable */ public function testDropTable() { $this->database->setExistingTables( [ 'table' ] ); @@ -740,7 +740,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::dropTable + * @covers Database::dropTable */ public function testDropNonExistingTable() { $this->assertFalse( @@ -750,7 +750,7 @@ class DatabaseSQLTest extends MediaWikiTestCase { /** * @dataProvider provideMakeList - * @covers DatabaseBase::makeList + * @covers Database::makeList */ public function testMakeList( $list, $mode, $sqlText ) { $this->assertEquals( trim( $this->database->makeList( diff --git a/tests/phpunit/includes/db/DatabaseSqliteTest.php b/tests/phpunit/includes/db/DatabaseSqliteTest.php index 80fb826bf3..172d68650d 100644 --- a/tests/phpunit/includes/db/DatabaseSqliteTest.php +++ b/tests/phpunit/includes/db/DatabaseSqliteTest.php @@ -7,7 +7,7 @@ class DatabaseSqliteMock extends DatabaseSqlite { $p['dbFilePath'] = ':memory:'; $p['schema'] = false; - return DatabaseBase::factory( 'SqliteMock', $p ); + return Database::factory( 'SqliteMock', $p ); } function query( $sql, $fname = '', $tempIgnore = false ) { diff --git a/tests/phpunit/includes/db/DatabaseTest.php b/tests/phpunit/includes/db/DatabaseTest.php index 48dc332a6d..606a20989c 100644 --- a/tests/phpunit/includes/db/DatabaseTest.php +++ b/tests/phpunit/includes/db/DatabaseTest.php @@ -2,11 +2,11 @@ /** * @group Database - * @group DatabaseBase + * @group Database */ class DatabaseTest extends MediaWikiTestCase { /** - * @var DatabaseBase + * @var Database */ protected $db; @@ -27,7 +27,7 @@ class DatabaseTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::dropTable + * @covers Database::dropTable */ public function testAddQuotesNull() { $check = "NULL"; @@ -266,7 +266,7 @@ class DatabaseTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::setTransactionListener() + * @covers Database::setTransactionListener() */ public function testTransactionListener() { $db = $this->db; @@ -298,7 +298,7 @@ class DatabaseTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::flushSnapshot() + * @covers Database::flushSnapshot() */ public function testFlushSnapshot() { $db = $this->db; @@ -350,9 +350,9 @@ class DatabaseTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::getFlag( - * @covers DatabaseBase::setFlag() - * @covers DatabaseBase::restoreFlags() + * @covers Database::getFlag( + * @covers Database::setFlag() + * @covers Database::restoreFlags() */ public function testFlagSetting() { $db = $this->db; @@ -390,8 +390,8 @@ class DatabaseTest extends MediaWikiTestCase { } /** - * @covers DatabaseBase::tablePrefix() - * @covers DatabaseBase::dbSchema() + * @covers Database::tablePrefix() + * @covers Database::dbSchema() */ public function testMutators() { $old = $this->db->tablePrefix(); diff --git a/tests/phpunit/includes/db/DatabaseTestHelper.php b/tests/phpunit/includes/db/DatabaseTestHelper.php index 31b692b30f..c5603c4093 100644 --- a/tests/phpunit/includes/db/DatabaseTestHelper.php +++ b/tests/phpunit/includes/db/DatabaseTestHelper.php @@ -1,10 +1,10 @@ getConnection( DB_MASTER, [], '' ); $lb->reuseConnection( $db ); // don't care @@ -322,7 +322,7 @@ class LBFactoryTest extends MediaWikiTestCase { $factory = $this->newLBFactoryMulti( [ 'localDomain' => $dbname ], [ 'dbname' => $dbname ] ); $lb = $factory->getMainLB(); - /** @var DatabaseBase $db */ + /** @var Database $db */ $db = $lb->getConnection( DB_MASTER, [], '' ); $lb->reuseConnection( $db ); // don't care diff --git a/tests/phpunit/includes/installer/DatabaseUpdaterTest.php b/tests/phpunit/includes/installer/DatabaseUpdaterTest.php index f01c47d04e..22d52f0744 100644 --- a/tests/phpunit/includes/installer/DatabaseUpdaterTest.php +++ b/tests/phpunit/includes/installer/DatabaseUpdaterTest.php @@ -16,7 +16,7 @@ class DatabaseUpdaterTest extends MediaWikiTestCase { } } -class FakeDatabase extends DatabaseBase { +class FakeDatabase extends Database { public $lastInsertTable; public $lastInsertData; @@ -70,7 +70,7 @@ class FakeDatabase extends DatabaseBase { * member variables. * If no more rows are available, false is returned. * - * @param ResultWrapper|stdClass $res Object as returned from DatabaseBase::query(), etc. + * @param ResultWrapper|stdClass $res Object as returned from Database::query(), etc. * @return stdClass|bool * @throws DBUnexpectedError Thrown if the database returns an error */ @@ -83,7 +83,7 @@ class FakeDatabase extends DatabaseBase { * form. Fields are retrieved with $row['fieldname']. * If no more rows are available, false is returned. * - * @param ResultWrapper $res Result object as returned from DatabaseBase::query(), etc. + * @param ResultWrapper $res Result object as returned from Database::query(), etc. * @return array|bool * @throws DBUnexpectedError Thrown if the database returns an error */ diff --git a/tests/phpunit/includes/utils/BatchRowUpdateTest.php b/tests/phpunit/includes/utils/BatchRowUpdateTest.php index 560b6d2fb6..ce6894e04b 100644 --- a/tests/phpunit/includes/utils/BatchRowUpdateTest.php +++ b/tests/phpunit/includes/utils/BatchRowUpdateTest.php @@ -129,7 +129,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase { $db = $this->mockDb(); $db->expects( $this->once() ) ->method( 'select' ) - // only testing second parameter of DatabaseBase::select + // only testing second parameter of Database::select ->with( 'some_table', $columns ) ->will( $this->returnValue( new ArrayIterator( [] ) ) ); @@ -164,7 +164,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase { /** * Slightly hackish to use reflection, but asserting different parameters - * to consecutive calls of DatabaseBase::select in phpunit is error prone + * to consecutive calls of Database::select in phpunit is error prone * * @dataProvider provider_readerSelectConditions */ @@ -214,7 +214,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase { protected function consecutivelyReturnFromSelect( array $results ) { $retvals = []; foreach ( $results as $rows ) { - // The DatabaseBase::select method returns iterators, so we do too. + // The Database::select method returns iterators, so we do too. $retvals[] = $this->returnValue( new ArrayIterator( $rows ) ); } @@ -235,8 +235,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase { } protected function mockDb() { - // Cant mock from DatabaseType or DatabaseBase, they dont - // have the full gamut of methods + // @TODO: mock from Database // FIXME: the constructor normally sets mAtomicLevels and mSrvCache $databaseMysql = $this->getMockBuilder( 'DatabaseMysql' ) ->disableOriginalConstructor() -- 2.20.1