Merge "Tests: Repalce "db" with getDb() method"

This commit is contained in:
jenkins-bot 2024-07-01 06:08:29 +00:00 committed by Gerrit Code Review
commit 3b005bfedc
3 changed files with 11 additions and 10 deletions

View file

@ -42,7 +42,7 @@ class FilterStoreTest extends MediaWikiIntegrationTestCase {
*/
private function createFilter( int $id ): void {
$row = self::DEFAULT_VALUES;
$row['timestamp'] = $this->db->timestamp( $row['timestamp'] );
$row['timestamp'] = $this->getDb()->timestamp( $row['timestamp'] );
$filter = $this->getFilterFromSpecs( [ 'id' => $id ] + $row );
$oldFilter = MutableFilter::newDefault();
// Use some black magic to bypass checks
@ -51,9 +51,9 @@ class FilterStoreTest extends MediaWikiIntegrationTestCase {
$row = $filterStore->filterToDatabaseRow( $filter, $oldFilter );
$row['af_actor'] = $this->getServiceContainer()->getActorNormalization()->acquireActorId(
$this->getTestUser()->getUserIdentity(),
$this->db
$this->getDb()
);
$this->db->newInsertQueryBuilder()
$this->getDb()->newInsertQueryBuilder()
->insertInto( 'abuse_filter' )
->row( $row )
->caller( __METHOD__ )

View file

@ -50,12 +50,13 @@ class PurgeOldLogIPDataTest extends MaintenanceBaseTestCase {
ConvertibleTimestamp::convert( TS_UNIX, self::FAKE_TIME ) - 2 * self::MAX_AGE
);
$rows = [
[ 'afl_id' => 1, 'afl_timestamp' => $this->db->timestamp( $oldTS ) ] + $defaultRow,
[ 'afl_id' => 2, 'afl_timestamp' => $this->db->timestamp( $oldTS ), 'afl_ip' => '' ] + $defaultRow,
[ 'afl_id' => 3, 'afl_timestamp' => $this->db->timestamp( self::FAKE_TIME ) ] + $defaultRow,
[ 'afl_id' => 4, 'afl_timestamp' => $this->db->timestamp( self::FAKE_TIME ), 'afl_ip' => '' ] + $defaultRow,
[ 'afl_id' => 1, 'afl_timestamp' => $this->getDb()->timestamp( $oldTS ) ] + $defaultRow,
[ 'afl_id' => 2, 'afl_timestamp' => $this->getDb()->timestamp( $oldTS ), 'afl_ip' => '' ] + $defaultRow,
[ 'afl_id' => 3, 'afl_timestamp' => $this->getDb()->timestamp( self::FAKE_TIME ) ] + $defaultRow,
[ 'afl_id' => 4, 'afl_timestamp' => $this->getDb()
->timestamp( self::FAKE_TIME ), 'afl_ip' => '' ] + $defaultRow,
];
$this->db->newInsertQueryBuilder()
$this->getDb()->newInsertQueryBuilder()
->insertInto( 'abuse_filter_log' )
->rows( $rows )
->caller( __METHOD__ )

View file

@ -38,7 +38,7 @@ class SearchFiltersTest extends MaintenanceBaseTestCase {
public function addDBData() {
$defaultRow = [
'af_actor' => 1,
'af_timestamp' => $this->db->timestamp( '20190826000000' ),
'af_timestamp' => $this->getDb()->timestamp( '20190826000000' ),
'af_enabled' => 1,
'af_comments' => '',
'af_public_comments' => 'Test filter',
@ -56,7 +56,7 @@ class SearchFiltersTest extends MaintenanceBaseTestCase {
[ 'af_id' => 3, 'af_pattern' => 'user_editcount % 3 !== 1' ] + $defaultRow,
[ 'af_id' => 4, 'af_pattern' => 'rmspecials(added_lines_pst) !== ""' ] + $defaultRow
];
$this->db->newInsertQueryBuilder()
$this->getDb()->newInsertQueryBuilder()
->insertInto( 'abuse_filter' )
->rows( $rows )
->caller( __METHOD__ )