Merge "Add test to guarantee tag uniqueness"

This commit is contained in:
jenkins-bot 2018-12-31 18:16:57 +00:00 committed by Gerrit Code Review
commit e164f16349

View file

@ -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
*