mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 23:40:19 +00:00
Merge "Add test to guarantee tag uniqueness"
This commit is contained in:
commit
e164f16349
|
@ -532,6 +532,33 @@ class AbuseFilterTest extends MediaWikiTestCase {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \AbuseFilter::bufferTagsToSetByAction
|
||||
*/
|
||||
public function testTagsToSetWillNotContainDuplicates() {
|
||||
$this->assertSame( [], AbuseFilter::$tagsToSet, 'precondition' );
|
||||
|
||||
$title = Title::newFromText( __METHOD__ );
|
||||
$vars = new AbuseFilterVariableHolder();
|
||||
$vars->setVar( 'ACTION', '' );
|
||||
$user = $this->getTestUser()->getUser();
|
||||
|
||||
$iterations = 2;
|
||||
while ( $iterations-- ) {
|
||||
AbuseFilter::takeConsequenceAction(
|
||||
'tag',
|
||||
[ 'uniqueTag' ],
|
||||
$title,
|
||||
$vars,
|
||||
'',
|
||||
0,
|
||||
$user
|
||||
);
|
||||
|
||||
$this->assertSame( [ 'uniqueTag' ], reset( AbuseFilter::$tagsToSet ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that version comparing works well
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue