tests: Use $this->getDb() instead of wfGetDB() in integration tests
Deprecated long time ago. Bug: T330641 Change-Id: Ia57f12d350c3346029aafae25534c9ed262a7e98
This commit is contained in:
parent
60b986e632
commit
cd2e19c050
36 changed files with 95 additions and 123 deletions
|
|
@ -103,9 +103,7 @@ class CategoryTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testNewFromRow_found() {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
|
||||
$category = Category::newFromRow( $dbw->newSelectQueryBuilder()
|
||||
$category = Category::newFromRow( $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files' ] )
|
||||
->from( 'category' )
|
||||
->where( [ 'cat_id' => 1 ] )
|
||||
|
|
@ -116,9 +114,7 @@ class CategoryTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testNewFromRow_notFoundWithoutTitle() {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
|
||||
$row = $dbw->newSelectQueryBuilder()
|
||||
$row = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files' ] )
|
||||
->from( 'category' )
|
||||
->where( [ 'cat_id' => 1 ] )
|
||||
|
|
@ -129,9 +125,7 @@ class CategoryTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testNewFromRow_notFoundWithTitle() {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
|
||||
$row = $dbw->newSelectQueryBuilder()
|
||||
$row = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files' ] )
|
||||
->from( 'category' )
|
||||
->where( [ 'cat_id' => 1 ] )
|
||||
|
|
|
|||
|
|
@ -104,8 +104,7 @@ class ArchivedRevisionLookupTest extends MediaWikiIntegrationTestCase {
|
|||
$rev->setContent( SlotRecord::MAIN, $newContent );
|
||||
$rev->setComment( CommentStoreComment::newUnsavedComment( 'just a test' ) );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$this->secondRev = $revisionStore->insertRevisionOn( $rev, $dbw );
|
||||
$this->secondRev = $revisionStore->insertRevisionOn( $rev, $this->getDb() );
|
||||
|
||||
// Delete the page
|
||||
$timestamp += 10;
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
$rev = $this->getRevisionRecordFromDetailsArray( $revDetails );
|
||||
|
||||
$store = $this->getServiceContainer()->getRevisionStore();
|
||||
$return = $store->insertRevisionOn( $rev, wfGetDB( DB_PRIMARY ) );
|
||||
$return = $store->insertRevisionOn( $rev, $this->getDb() );
|
||||
|
||||
// is the new revision correct?
|
||||
$this->assertRevisionCompleteness( $return );
|
||||
|
|
@ -511,14 +511,14 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
// Insert the first revision
|
||||
$revOne = $this->getRevisionRecordFromDetailsArray( $revDetails );
|
||||
$firstReturn = $store->insertRevisionOn( $revOne, wfGetDB( DB_PRIMARY ) );
|
||||
$firstReturn = $store->insertRevisionOn( $revOne, $this->getDb() );
|
||||
$this->assertLinkTargetsEqual( $title, $firstReturn->getPageAsLinkTarget() );
|
||||
$this->assertRevisionRecordsEqual( $revOne, $firstReturn );
|
||||
|
||||
// Insert a second revision inheriting the same blob address
|
||||
$revDetails['slot'] = SlotRecord::newInherited( $firstReturn->getSlot( SlotRecord::MAIN ) );
|
||||
$revTwo = $this->getRevisionRecordFromDetailsArray( $revDetails );
|
||||
$secondReturn = $store->insertRevisionOn( $revTwo, wfGetDB( DB_PRIMARY ) );
|
||||
$secondReturn = $store->insertRevisionOn( $revTwo, $this->getDb() );
|
||||
$this->assertLinkTargetsEqual( $title, $secondReturn->getPageAsLinkTarget() );
|
||||
$this->assertRevisionRecordsEqual( $revTwo, $secondReturn );
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
$this->expectException( get_class( $exception ) );
|
||||
$this->expectExceptionMessage( $exception->getMessage() );
|
||||
$this->expectExceptionCode( $exception->getCode() );
|
||||
$store->insertRevisionOn( $rev, wfGetDB( DB_PRIMARY ) );
|
||||
$store->insertRevisionOn( $rev, $this->getDb() );
|
||||
}
|
||||
|
||||
public static function provideNewNullRevision() {
|
||||
|
|
@ -667,12 +667,12 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
$baseRev = $this->getRevisionRecordFromDetailsArray( $revDetails );
|
||||
$store = $this->getServiceContainer()->getRevisionStore();
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$baseRev = $store->insertRevisionOn( $baseRev, $dbw );
|
||||
$page->updateRevisionOn( $dbw, $baseRev, $page->getLatest() );
|
||||
|
||||
$record = $store->newNullRevision(
|
||||
wfGetDB( DB_PRIMARY ),
|
||||
$this->getDb(),
|
||||
$title,
|
||||
$comment,
|
||||
$minor,
|
||||
|
|
@ -707,7 +707,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
public function testNewNullRevision_nonExistingTitle() {
|
||||
$store = $this->getServiceContainer()->getRevisionStore();
|
||||
$record = $store->newNullRevision(
|
||||
wfGetDB( DB_PRIMARY ),
|
||||
$this->getDb(),
|
||||
Title::newFromText( __METHOD__ . '.iDontExist!' ),
|
||||
CommentStoreComment::newUnsavedComment( __METHOD__ . ' comment' ),
|
||||
false,
|
||||
|
|
@ -1894,17 +1894,17 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$this->assertSame(
|
||||
0,
|
||||
$store->countRevisionsByPageId( wfGetDB( DB_PRIMARY ), $page->getId() )
|
||||
$store->countRevisionsByPageId( $this->getDb(), $page->getId() )
|
||||
);
|
||||
$page->doUserEditContent( new WikitextContent( 'a' ), $user, 'a' );
|
||||
$this->assertSame(
|
||||
1,
|
||||
$store->countRevisionsByPageId( wfGetDB( DB_PRIMARY ), $page->getId() )
|
||||
$store->countRevisionsByPageId( $this->getDb(), $page->getId() )
|
||||
);
|
||||
$page->doUserEditContent( new WikitextContent( 'b' ), $user, 'b' );
|
||||
$this->assertSame(
|
||||
2,
|
||||
$store->countRevisionsByPageId( wfGetDB( DB_PRIMARY ), $page->getId() )
|
||||
$store->countRevisionsByPageId( $this->getDb(), $page->getId() )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1918,17 +1918,17 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$this->assertSame(
|
||||
0,
|
||||
$store->countRevisionsByTitle( wfGetDB( DB_PRIMARY ), $page->getTitle() )
|
||||
$store->countRevisionsByTitle( $this->getDb(), $page->getTitle() )
|
||||
);
|
||||
$page->doUserEditContent( new WikitextContent( 'a' ), $user, 'a' );
|
||||
$this->assertSame(
|
||||
1,
|
||||
$store->countRevisionsByTitle( wfGetDB( DB_PRIMARY ), $page->getTitle() )
|
||||
$store->countRevisionsByTitle( $this->getDb(), $page->getTitle() )
|
||||
);
|
||||
$page->doUserEditContent( new WikitextContent( 'b' ), $user, 'b' );
|
||||
$this->assertSame(
|
||||
2,
|
||||
$store->countRevisionsByTitle( wfGetDB( DB_PRIMARY ), $page->getTitle() )
|
||||
$store->countRevisionsByTitle( $this->getDb(), $page->getTitle() )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1946,7 +1946,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$store = $this->getServiceContainer()->getRevisionStore();
|
||||
$result = $store->userWasLastToEdit(
|
||||
wfGetDB( DB_PRIMARY ),
|
||||
$this->getDb(),
|
||||
$page->getId(),
|
||||
$sysop->getId(),
|
||||
'20160101010101'
|
||||
|
|
@ -1969,7 +1969,7 @@ class RevisionStoreDbTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$store = $this->getServiceContainer()->getRevisionStore();
|
||||
$result = $store->userWasLastToEdit(
|
||||
wfGetDB( DB_PRIMARY ),
|
||||
$this->getDb(),
|
||||
$page->getId(),
|
||||
$sysop->getId(),
|
||||
$startTime
|
||||
|
|
|
|||
|
|
@ -122,8 +122,7 @@ class ApiBlockTest extends ApiTestCase {
|
|||
|
||||
$this->doBlock( [ 'tags' => 'custom tag' ] );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$this->assertSame( 1, (int)$dbw->newSelectQueryBuilder()
|
||||
$this->assertSame( 1, (int)$this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'COUNT(*)' )
|
||||
->from( 'logging' )
|
||||
->join( 'change_tag', null, 'ct_log_id = log_id' )
|
||||
|
|
@ -176,8 +175,7 @@ class ApiBlockTest extends ApiTestCase {
|
|||
|
||||
$res = $this->doBlock( [ 'noemail' => '' ] );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$this->assertSame( '1', $dbw->newSelectQueryBuilder()
|
||||
$this->assertSame( '1', $this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'ipb_block_email' )
|
||||
->from( 'ipblocks' )
|
||||
->where( [ 'ipb_id' => $res[0]['block']['id'] ] )
|
||||
|
|
@ -200,8 +198,7 @@ class ApiBlockTest extends ApiTestCase {
|
|||
MWTimestamp::setFakeTime( $fakeTime );
|
||||
$res = $this->doBlock( [ 'expiry' => '1 day' ] );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$expiry = $dbw->newSelectQueryBuilder()
|
||||
$expiry = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'ipb_expiry' )
|
||||
->from( 'ipblocks' )
|
||||
->where( [ 'ipb_id' => $res[0]['block']['id'] ] )
|
||||
|
|
|
|||
|
|
@ -321,10 +321,9 @@ class ApiChangeContentModelTest extends ApiTestCase {
|
|||
'Second revision should come after the first'
|
||||
);
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$this->assertSame(
|
||||
'4',
|
||||
$dbw->newSelectQueryBuilder()
|
||||
$this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'ctd_count' )
|
||||
->from( 'change_tag_def' )
|
||||
->where( [ 'ctd_name' => 'api edit content model tag' ] )
|
||||
|
|
|
|||
|
|
@ -73,14 +73,14 @@ class ApiComparePagesTest extends ApiTestCase {
|
|||
|
||||
$id = $this->addPage( 'D', 'D 1' );
|
||||
self::$repl['pageD'] = Title::makeTitle( NS_MAIN, 'ApiComparePagesTest D' )->getArticleID();
|
||||
wfGetDB( DB_PRIMARY )->delete( 'revision', [ 'rev_id' => $id ] );
|
||||
$this->getDb()->delete( 'revision', [ 'rev_id' => $id ] );
|
||||
|
||||
self::$repl['revE1'] = $this->addPage( 'E', 'E 1' );
|
||||
self::$repl['revE2'] = $this->addPage( 'E', 'E 2' );
|
||||
self::$repl['revE3'] = $this->addPage( 'E', 'E 3' );
|
||||
self::$repl['revE4'] = $this->addPage( 'E', 'E 4' );
|
||||
self::$repl['pageE'] = Title::makeTitle( NS_MAIN, 'ApiComparePagesTest E' )->getArticleID();
|
||||
wfGetDB( DB_PRIMARY )->update(
|
||||
$this->getDb()->update(
|
||||
'page', [ 'page_latest' => 0 ], [ 'page_id' => self::$repl['pageE'] ]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,7 @@ class ApiDeleteTest extends ApiTestCase {
|
|||
|
||||
$this->assertFalse( $title->exists( Title::READ_LATEST ) );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$this->assertSame( 'custom tag', $dbw->newSelectQueryBuilder()
|
||||
$this->assertSame( 'custom tag', $this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'ctd_name' )
|
||||
->from( 'logging' )
|
||||
->join( 'change_tag', null, 'ct_log_id = log_id' )
|
||||
|
|
|
|||
|
|
@ -315,8 +315,7 @@ class ApiLoginTest extends ApiTestCase {
|
|||
// A is unsalted MD5 (thus fast) ... we don't care about security here, this is test only
|
||||
$passwordHash = $passwordFactory->newFromPlaintext( $password );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw->insert(
|
||||
$this->getDb()->insert(
|
||||
'bot_passwords',
|
||||
[
|
||||
'bp_user' => $centralId,
|
||||
|
|
|
|||
|
|
@ -135,8 +135,7 @@ class ApiParseTest extends ApiTestCase {
|
|||
* Set up an interwiki entry for testing.
|
||||
*/
|
||||
protected function setupInterwiki() {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw->insert(
|
||||
$this->getDb()->insert(
|
||||
'interwiki',
|
||||
[
|
||||
'iw_prefix' => 'madeuplanguage',
|
||||
|
|
|
|||
|
|
@ -197,8 +197,7 @@ class ApiStashEditTest extends ApiTestCase {
|
|||
$this->expectApiErrorCode( 'missingrev' );
|
||||
|
||||
// Corrupt the database. @todo Does the API really need to fail gracefully for this case?
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
$this->getDb()->newUpdateQueryBuilder()
|
||||
->update( 'page' )
|
||||
->set( [ 'page_latest' => 0 ] )
|
||||
->where( [ 'page_id' => $revRecord->getPageId() ] )
|
||||
|
|
|
|||
|
|
@ -122,8 +122,7 @@ class ApiUnblockTest extends ApiTestCase {
|
|||
|
||||
$this->doUnblock( [ 'tags' => 'custom tag' ] );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$this->assertSame( 1, (int)$dbw->newSelectQueryBuilder()
|
||||
$this->assertSame( 1, (int)$this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'COUNT(*)' )
|
||||
->from( 'logging' )
|
||||
->join( 'change_tag', null, 'ct_log_id = log_id' )
|
||||
|
|
|
|||
|
|
@ -215,10 +215,9 @@ class ApiUserrightsTest extends ApiTestCase {
|
|||
|
||||
$this->doSuccessfulRightsChange( 'sysop', [ 'tags' => 'custom tag' ], $user );
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$this->assertSame(
|
||||
'custom tag',
|
||||
$dbr->newSelectQueryBuilder()
|
||||
$this->getDb()->newSelectQueryBuilder()
|
||||
->select( 'ctd_name' )
|
||||
->from( 'logging' )
|
||||
->join( 'change_tag', null, 'ct_log_id = log_id' )
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Block\DatabaseBlock;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\TestingAccessWrapper;
|
||||
use Wikimedia\Timestamp\ConvertibleTimestamp;
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ class ApiQueryBlockInfoTraitTest extends MediaWikiIntegrationTestCase {
|
|||
$data = [];
|
||||
|
||||
$mock = $this->getMockForTrait( ApiQueryBlockInfoTrait::class );
|
||||
$mock->method( 'getDB' )->willReturn( wfGetDB( DB_REPLICA ) );
|
||||
$mock->method( 'getDB' )->willReturn( $this->getDb() );
|
||||
$mock->method( 'getAuthority' )
|
||||
->willReturn( $this->getMutableTestUser()->getUser() );
|
||||
$mock->method( 'addTables' )->willReturnCallback( static function ( $v ) use ( &$data ) {
|
||||
|
|
@ -48,7 +49,7 @@ class ApiQueryBlockInfoTraitTest extends MediaWikiIntegrationTestCase {
|
|||
public static function provideAddBlockInfoToQuery() {
|
||||
$queryInfo = DatabaseBlock::getQueryInfo();
|
||||
|
||||
$db = wfGetDB( DB_REPLICA );
|
||||
$db = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->getReplicaDatabase();
|
||||
$ts = $db->addQuotes( $db->timestamp( '20190101000000' ) );
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -156,15 +156,15 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
}
|
||||
|
||||
public function testSpecialPageAliases() {
|
||||
$this->assertCount(
|
||||
count( $this->getServiceContainer()->getSpecialPageFactory()->getNames() ),
|
||||
$this->assertSameSize(
|
||||
$this->getServiceContainer()->getSpecialPageFactory()->getNames(),
|
||||
$this->doQuery( 'specialpagealiases' )
|
||||
);
|
||||
}
|
||||
|
||||
public function testMagicWords() {
|
||||
$this->assertCount(
|
||||
count( $this->getServiceContainer()->getContentLanguage()->getMagicWords() ),
|
||||
$this->assertSameSize(
|
||||
$this->getServiceContainer()->getContentLanguage()->getMagicWords(),
|
||||
$this->doQuery( 'magicwords' )
|
||||
);
|
||||
}
|
||||
|
|
@ -181,8 +181,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
|
|||
MainConfigNames::ScriptPath => '/w',
|
||||
] );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw->insert(
|
||||
$this->getDb()->insert(
|
||||
'interwiki',
|
||||
[
|
||||
[
|
||||
|
|
|
|||
|
|
@ -2267,7 +2267,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
// We're testing with $wgNewUserLog = false, so assert that it worked
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$maxLogId = $dbw->newSelectQueryBuilder()
|
||||
->select( 'MAX(log_id)' )
|
||||
->from( 'logging' )
|
||||
|
|
@ -2545,7 +2545,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
|
|||
|
||||
$this->config->set( MainConfigNames::NewUserLog, true );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$maxLogId = $dbw->newSelectQueryBuilder()
|
||||
->select( 'MAX(log_id)' )
|
||||
->from( 'logging' )
|
||||
|
|
@ -3025,7 +3025,7 @@ class AuthManagerTest extends \MediaWikiIntegrationTestCase {
|
|||
], $logger->getBuffer() );
|
||||
$logger->clearBuffer();
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$maxLogId = $dbw->newSelectQueryBuilder()
|
||||
->select( 'MAX(log_id)' )
|
||||
->from( 'logging' )
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati
|
|||
public function testTestUserCanAuthenticate() {
|
||||
$user = $this->getMutableTestUser()->getUser();
|
||||
$userName = $user->getName();
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
|
||||
$provider = $this->getProvider();
|
||||
|
||||
|
|
@ -172,8 +172,7 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati
|
|||
|
||||
$user = $this->getMutableTestUser()->getUser();
|
||||
$userName = $user->getName();
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$row = $dbw->newSelectQueryBuilder()
|
||||
$row = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( '*' )
|
||||
->from( 'user' )
|
||||
->where( [ 'user_name' => $userName ] )
|
||||
|
|
@ -233,7 +232,7 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati
|
|||
$testUser = $this->getMutableTestUser();
|
||||
$userName = $testUser->getUser()->getName();
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$id = $testUser->getUser()->getId();
|
||||
|
||||
$req = new PasswordAuthenticationRequest();
|
||||
|
|
@ -505,7 +504,7 @@ class LocalPasswordPrimaryAuthenticationProviderTest extends \MediaWikiIntegrati
|
|||
$oldpass = $testUser->getPassword();
|
||||
$newpass = 'NewPassword';
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$oldExpiry = $dbw->newSelectQueryBuilder()
|
||||
->select( 'user_password_expires' )
|
||||
->from( 'user' )
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
|
|||
public function testTestUserCanAuthenticate() {
|
||||
$user = self::getMutableTestUser()->getUser();
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$config = $this->getServiceContainer()->getMainConfig();
|
||||
// A is unsalted MD5 (thus fast) ... we don't care about security here, this is test only
|
||||
$passwordFactory = new PasswordFactory( $config->get( MainConfigNames::PasswordConfig ), 'A' );
|
||||
|
|
@ -276,7 +276,7 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
|
|||
|
||||
$password = 'TemporaryPassword';
|
||||
$hash = ':A:' . md5( $password );
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
->update( 'user' )
|
||||
->set( [ 'user_newpassword' => $hash, 'user_newpass_time' => $dbw->timestamp( time() - 10 ) ] )
|
||||
|
|
@ -496,7 +496,7 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
|
|||
$oldpass = 'OldTempPassword';
|
||||
$newpass = 'NewTempPassword';
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$oldHash = $dbw->newSelectQueryBuilder()
|
||||
->select( 'user_newpassword' )
|
||||
->from( 'user' )
|
||||
|
|
@ -603,7 +603,7 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
|
|||
public function testProviderChangeAuthenticationDataEmail() {
|
||||
$user = self::getMutableTestUser()->getUser();
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
->update( 'user' )
|
||||
->set( [ 'user_newpass_time' => $dbw->timestamp( time() - 5 * 3600 ) ] )
|
||||
|
|
|
|||
|
|
@ -214,8 +214,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase {
|
|||
new NamespaceRestriction( $block->getId(), NS_USER ),
|
||||
] );
|
||||
|
||||
$db = wfGetDB( DB_REPLICA );
|
||||
$result = $db->newSelectQueryBuilder()
|
||||
$result = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ '*' ] )
|
||||
->from( 'ipblocks_restrictions' )
|
||||
->where( [ 'ir_ipb_id' => $block->getId() ] )
|
||||
|
|
@ -240,8 +239,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase {
|
|||
new PageRestriction( $block->getId(), $page->getId() ),
|
||||
] );
|
||||
|
||||
$db = wfGetDB( DB_REPLICA );
|
||||
$result = $db->newSelectQueryBuilder()
|
||||
$result = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ '*' ] )
|
||||
->from( 'ipblocks_restrictions' )
|
||||
->where( [ 'ir_ipb_id' => $block->getId() ] )
|
||||
|
|
@ -263,8 +261,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase {
|
|||
|
||||
$this->blockRestrictionStore->update( [] );
|
||||
|
||||
$db = wfGetDB( DB_REPLICA );
|
||||
$result = $db->newSelectQueryBuilder()
|
||||
$result = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ '*' ] )
|
||||
->from( 'ipblocks_restrictions' )
|
||||
->where( [ 'ir_ipb_id' => $block->getId() ] )
|
||||
|
|
@ -289,8 +286,7 @@ class BlockRestrictionStoreTest extends \MediaWikiLangTestCase {
|
|||
new PageRestriction( $block->getId(), $page->getId() ),
|
||||
] );
|
||||
|
||||
$db = wfGetDB( DB_REPLICA );
|
||||
$result = $db->newSelectQueryBuilder()
|
||||
$result = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( [ '*' ] )
|
||||
->from( 'ipblocks_restrictions' )
|
||||
->where( [ 'ir_ipb_id' => $block->getId() ] )
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class ChangeTagsTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
private function emptyChangeTagsTables() {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newDeleteQueryBuilder()
|
||||
->deleteFrom( 'change_tag' )
|
||||
->where( ISQLPlatform::ALL_ROWS )
|
||||
|
|
@ -65,7 +65,7 @@ class ChangeTagsTest extends MediaWikiIntegrationTestCase {
|
|||
ChangeTags::updateTags( [ 'foo', 'bar', '0' ], [], $rcId );
|
||||
// HACK resolve deferred group concats (see comment in provideModifyDisplayQuery)
|
||||
if ( isset( $modifiedQuery['fields']['ts_tags'] ) ) {
|
||||
$modifiedQuery['fields']['ts_tags'] = wfGetDB( DB_REPLICA )
|
||||
$modifiedQuery['fields']['ts_tags'] = $this->getDb()
|
||||
->buildGroupConcatField( ...$modifiedQuery['fields']['ts_tags'] );
|
||||
}
|
||||
if ( isset( $modifiedQuery['exception'] ) ) {
|
||||
|
|
|
|||
|
|
@ -395,7 +395,7 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
public function testNiceDomains() {
|
||||
global $wgDBname;
|
||||
|
||||
if ( wfGetDB( DB_PRIMARY )->databasesAreIndependent() ) {
|
||||
if ( $this->getDb()->databasesAreIndependent() ) {
|
||||
self::markTestSkipped( "Skipping tests about selecting DBs: not applicable" );
|
||||
return;
|
||||
}
|
||||
|
|
@ -474,7 +474,7 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
public function testTrickyDomain() {
|
||||
global $wgDBname;
|
||||
|
||||
if ( wfGetDB( DB_PRIMARY )->databasesAreIndependent() ) {
|
||||
if ( $this->getDb()->databasesAreIndependent() ) {
|
||||
self::markTestSkipped( "Skipping tests about selecting DBs: not applicable" );
|
||||
return;
|
||||
}
|
||||
|
|
@ -538,7 +538,7 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testInvalidSelectDB() {
|
||||
if ( wfGetDB( DB_PRIMARY )->databasesAreIndependent() ) {
|
||||
if ( $this->getDb()->databasesAreIndependent() ) {
|
||||
$this->markTestSkipped( "Not applicable per databasesAreIndependent()" );
|
||||
}
|
||||
|
||||
|
|
@ -602,7 +602,7 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
|
|||
public function testRedefineLocalDomain() {
|
||||
global $wgDBname;
|
||||
|
||||
if ( wfGetDB( DB_PRIMARY )->databasesAreIndependent() ) {
|
||||
if ( $this->getDb()->databasesAreIndependent() ) {
|
||||
self::markTestSkipped( "Skipping tests about selecting DBs: not applicable" );
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -828,8 +828,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
$this->setTransactionTicket( $update );
|
||||
$update->doUpdate();
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$time1 = $dbw->lastDoneWrites();
|
||||
$time1 = $this->getDb()->lastDoneWrites();
|
||||
$this->assertGreaterThan( 0, $time1 );
|
||||
|
||||
$update = new class( $t, $po ) extends LinksUpdate {
|
||||
|
|
@ -839,7 +838,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
|
|||
};
|
||||
$update->setStrictTestMode();
|
||||
$update->doUpdate();
|
||||
$time2 = wfGetDB( DB_PRIMARY )->lastDoneWrites();
|
||||
$time2 = $this->getDb()->lastDoneWrites();
|
||||
$this->assertSame( $time1, $time2 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class RefreshSecondaryDataUpdateTest extends MediaWikiIntegrationTestCase {
|
|||
$revision->method( 'getId' )
|
||||
->willReturn( 42 );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
|
||||
$dbw->startAtomic( __METHOD__ );
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ class RefreshSecondaryDataUpdateTest extends MediaWikiIntegrationTestCase {
|
|||
$revision->method( 'getId' )
|
||||
->willReturn( 42 );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->startAtomic( __METHOD__ );
|
||||
$goodCalls = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class SiteStatsUpdateTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testDoUpdate() {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$statsInit = new SiteStatsInit( $dbw );
|
||||
$statsInit->refresh();
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class EditPageConstraintsTest extends MediaWikiLangTestCase {
|
|||
$page->doUserEditContent( $content, $user, "base text for test" );
|
||||
|
||||
// Set the latest timestamp back a while
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
->update( 'revision' )
|
||||
->set( [ 'rev_timestamp' => $dbw->timestamp( '20120101000000' ) ] )
|
||||
|
|
@ -167,7 +167,7 @@ class EditPageConstraintsTest extends MediaWikiLangTestCase {
|
|||
// Set the time of the deletion to be a specific time, so we can be sure to start the
|
||||
// edit before it. Since the constraint will query for the most recent timestamp,
|
||||
// update *all* deletion logs for the page to the same timestamp (1 January 2020)
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
->update( 'logging' )
|
||||
->set( [ 'log_timestamp' => $dbw->timestamp( '20200101000000' ) ] )
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class EditPageTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
protected function forceRevisionDate( WikiPage $page, $timestamp ) {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
->update( 'revision' )
|
||||
|
|
@ -337,7 +337,7 @@ class EditPageTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
);
|
||||
|
||||
wfGetDB( DB_PRIMARY )->begin( __METHOD__ );
|
||||
$this->getDb()->begin( __METHOD__ );
|
||||
|
||||
$edit = [ 'wpTextbox1' => $editText ];
|
||||
if ( $ignoreBlank ) {
|
||||
|
|
@ -351,7 +351,7 @@ class EditPageTest extends MediaWikiLangTestCase {
|
|||
$page2 = $this->assertEdit(
|
||||
$pageTitle2, null, $user, $edit, $expectedCode, $expectedText, $desc );
|
||||
|
||||
wfGetDB( DB_PRIMARY )->commit( __METHOD__ );
|
||||
$this->getDb()->commit( __METHOD__ );
|
||||
|
||||
$this->assertSame( 0, DeferredUpdates::pendingUpdatesCount(), 'No deferred updates' );
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ class EditPageTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
);
|
||||
|
||||
wfGetDB( DB_PRIMARY )->begin( __METHOD__ );
|
||||
$this->getDb()->begin( __METHOD__ );
|
||||
|
||||
$text = "two";
|
||||
$edit = [
|
||||
|
|
@ -519,7 +519,7 @@ class EditPageTest extends MediaWikiLangTestCase {
|
|||
EditPage::AS_SUCCESS_UPDATE, $text,
|
||||
"expected successful update with given text" );
|
||||
|
||||
wfGetDB( DB_PRIMARY )->commit( __METHOD__ );
|
||||
$this->getDb()->commit( __METHOD__ );
|
||||
|
||||
$this->assertGreaterThan( 0, $checkIds[0], "First event rev ID set" );
|
||||
$this->assertGreaterThan( 0, $checkIds[1], "Second edit hook rev ID set" );
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ class LocalFileTest extends MediaWikiIntegrationTestCase {
|
|||
] )
|
||||
);
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$norm = $services->getActorNormalization();
|
||||
$user = $this->getTestSysop()->getUserIdentity();
|
||||
$actorId = $norm->acquireActorId( $user, $dbw );
|
||||
|
|
@ -916,7 +916,7 @@ class LocalFileTest extends MediaWikiIntegrationTestCase {
|
|||
* @dataProvider provideReserializeMetadata
|
||||
*/
|
||||
public function testReserializeMetadata( $input, $expected ) {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$services = $this->getServiceContainer();
|
||||
$norm = $services->getActorNormalization();
|
||||
$user = $this->getTestSysop()->getUserIdentity();
|
||||
|
|
@ -990,7 +990,7 @@ class LocalFileTest extends MediaWikiIntegrationTestCase {
|
|||
'containerPaths' => [ 'test-public' => __DIR__ . '/../../../data/media' ]
|
||||
] )
|
||||
] );
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$services = $this->getServiceContainer();
|
||||
$norm = $services->getActorNormalization();
|
||||
$user = $this->getTestSysop()->getUserIdentity();
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ EOF
|
|||
$importer->setUsernamePrefix( 'Xxx', $assign );
|
||||
$importer->doImport();
|
||||
|
||||
$db = wfGetDB( DB_PRIMARY );
|
||||
$db = $this->getDb();
|
||||
$row = $services->getRevisionStore()->newSelectQueryBuilder( $db )
|
||||
->where( [ 'rev_timestamp' => $db->timestamp( "201601010{$n}0000" ) ] )
|
||||
->caller( __METHOD__ )->fetchRow();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class InterwikiTest extends MediaWikiIntegrationTestCase {
|
|||
//// tests for static data access methods below ///////////////////////////////////////////////
|
||||
|
||||
private function populateDB( $iwrows ) {
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newDeleteQueryBuilder()
|
||||
->deleteFrom( 'interwiki' )
|
||||
->where( ISQLPlatform::ALL_ROWS )
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class MessageCacheTest extends MediaWikiLangTestCase {
|
|||
$uckey = $this->getServiceContainer()->getContentLanguage()->ucfirst( $message );
|
||||
$oldText = $messageCache->get( $message ); // "Ausführen"
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->startAtomic( __METHOD__ ); // simulate request and block deferred updates
|
||||
$messageCache->replace( $uckey, 'Allez!' );
|
||||
$this->assertEquals( 'Allez!',
|
||||
|
|
@ -194,7 +194,7 @@ class MessageCacheTest extends MediaWikiLangTestCase {
|
|||
public function testNoDBAccessContentLanguage() {
|
||||
global $wgLanguageCode;
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$dbr = $this->getDb();
|
||||
|
||||
$messageCache = $this->getServiceContainer()->getMessageCache();
|
||||
$messageCache->getMsgFromNamespace( 'allpages', $wgLanguageCode );
|
||||
|
|
@ -210,7 +210,7 @@ class MessageCacheTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function testNoDBAccessNonContentLanguage() {
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$dbr = $this->getDb();
|
||||
|
||||
$messageCache = $this->getServiceContainer()->getMessageCache();
|
||||
$messageCache->getMsgFromNamespace( 'allpages/nl', 'nl' );
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
|
|||
};
|
||||
|
||||
// XXX: DeferredUpdates bound to transactions in CLI mode
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->begin();
|
||||
$this->cache->merge( $key, $func );
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$key = 'keyB';
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->begin();
|
||||
$cache->merge( $key, $func );
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class MultiWriteBagOStuffTest extends MediaWikiIntegrationTestCase {
|
|||
$expectValue = clone $value;
|
||||
|
||||
// XXX: DeferredUpdates bound to transactions in CLI mode
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->begin();
|
||||
$this->cache->set( $key, $value );
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class PageArchiveTest extends MediaWikiIntegrationTestCase {
|
|||
$rev->setContent( SlotRecord::MAIN, new TextContent( 'Lorem Ipsum' ) );
|
||||
$rev->setComment( CommentStoreComment::newUnsavedComment( 'just a test' ) );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$this->ipRev = $revisionStore->insertRevisionOn( $rev, $dbw );
|
||||
|
||||
$this->deletePage( $page, '', $user );
|
||||
|
|
|
|||
|
|
@ -249,8 +249,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
|
||||
// TODO: test various options; needs temporary hooks
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$res = $dbr->newSelectQueryBuilder()
|
||||
$res = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( '*' )
|
||||
->from( 'pagelinks' )
|
||||
->where( [ 'pl_from' => $page->getId() ] )
|
||||
|
|
@ -325,8 +324,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
$this->assertTrue( $page->exists(), "WikiPage object should indicate that the page now exists" );
|
||||
|
||||
# ------------------------
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$res = $dbr->newSelectQueryBuilder()
|
||||
$res = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( '*' )
|
||||
->from( 'pagelinks' )
|
||||
->where( [ 'pl_from' => $id ] )
|
||||
|
|
@ -392,8 +390,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
$this->assertStringNotContainsString( '~~~~', $newText, 'PST must substitute signature.' );
|
||||
|
||||
# ------------------------
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$res = $dbr->newSelectQueryBuilder()
|
||||
$res = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( '*' )
|
||||
->from( 'pagelinks' )
|
||||
->where( [ 'pl_from' => $id ] )
|
||||
|
|
@ -512,8 +509,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase {
|
|||
$this->runJobs();
|
||||
|
||||
# ------------------------
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$res = $dbr->newSelectQueryBuilder()
|
||||
$res = $this->getDb()->newSelectQueryBuilder()
|
||||
->select( '*' )
|
||||
->from( 'pagelinks' )
|
||||
->where( [ 'pl_from' => $id ] )
|
||||
|
|
@ -1967,7 +1963,7 @@ more stuff
|
|||
$title = Title::makeTitleSafe( NS_MAIN, 'A new redirect' );
|
||||
$this->assertFalse( $title->isRedirect() );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$store = $this->getServiceContainer()->getRevisionStore();
|
||||
$page = $this->newPage( $title );
|
||||
$page->insertOn( $dbw );
|
||||
|
|
|
|||
|
|
@ -21,10 +21,9 @@ class ReverseChronologicalPagerTest extends MediaWikiIntegrationTestCase {
|
|||
public function testGetDateCond( $params, $expected ) {
|
||||
$pager = $this->getMockForAbstractClass( ReverseChronologicalPager::class );
|
||||
$pagerWrapper = TestingAccessWrapper::newFromObject( $pager );
|
||||
$db = wfGetDB( DB_PRIMARY );
|
||||
|
||||
$pager->getDateCond( ...$params );
|
||||
$this->assertEquals( $pagerWrapper->endOffset, $db->timestamp( $expected ) );
|
||||
$this->assertEquals( $pagerWrapper->endOffset, $this->getDb()->timestamp( $expected ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,7 +69,7 @@ class ReverseChronologicalPagerTest extends MediaWikiIntegrationTestCase {
|
|||
$pager = $this->getMockForAbstractClass( ReverseChronologicalPager::class );
|
||||
$pagerWrapper = TestingAccessWrapper::newFromObject( $pager );
|
||||
$timestamp = MWTimestamp::getInstance();
|
||||
$db = wfGetDB( DB_PRIMARY );
|
||||
$db = $this->getDb();
|
||||
|
||||
$currYear = $timestamp->format( 'Y' );
|
||||
$currMonth = $timestamp->format( 'n' );
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class BotPasswordSessionProviderTest extends MediaWikiIntegrationTestCase {
|
|||
->getLookup( 'local' )
|
||||
->centralIdFromName( $sysop->getName() );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newDeleteQueryBuilder()
|
||||
->deleteFrom( 'bot_passwords' )
|
||||
->where( [ 'bp_user' => $userId, 'bp_app_id' => 'BotPasswordSessionProvider' ] )
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
|
|||
$passwordFactory = $this->getServiceContainer()->getPasswordFactory();
|
||||
$passwordHash = $passwordFactory->newFromPlaintext( 'foobaz' );
|
||||
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newDeleteQueryBuilder()
|
||||
->deleteFrom( 'bot_passwords' )
|
||||
->where( [ 'bp_user' => [ 42, 43 ], 'bp_app_id' => 'BotPassword' ] )
|
||||
|
|
@ -194,7 +194,7 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertInstanceOf( InvalidPassword::class, $password );
|
||||
|
||||
$bp = TestingAccessWrapper::newFromObject( BotPassword::newFromCentralId( 42, 'BotPassword' ) );
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$dbw = $this->getDb();
|
||||
$dbw->newUpdateQueryBuilder()
|
||||
->update( 'bot_passwords' )
|
||||
->set( [ 'bp_password' => 'garbage' ] )
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
|
|||
MainConfigNames::ExperiencedUserMemberSince => 30,
|
||||
] );
|
||||
|
||||
$db = wfGetDB( DB_PRIMARY );
|
||||
$db = $this->getDb();
|
||||
$row = User::newQueryBuilder( $db )
|
||||
->where( [ 'user_id' => $this->user->getId() ] )
|
||||
->caller( __METHOD__ )
|
||||
|
|
|
|||
Loading…
Reference in a new issue