mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Tests: Repalce "db" with getDb() method
Bug: T316841 Change-Id: I40eb000f008e51aba581ee8e33a8421ff111fbf1
This commit is contained in:
parent
9fc29beb09
commit
6a091dcb39
|
@ -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__ )
|
||||
|
|
|
@ -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__ )
|
||||
|
|
|
@ -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__ )
|
||||
|
|
Loading…
Reference in a new issue