mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Use assertStatusGood and such from MediaWiki core
Turns out the MediaWikiIntegrationTestCase base class comes with a bunch of convenience methods for this. We can even remove the custom messages because these methods already print a lot of debug info in case of a failure. Change-Id: I61fd86f1560c8e3bcf39a30b09fecdb063424613
This commit is contained in:
parent
b7112c6152
commit
8565b8d7c4
|
@ -119,6 +119,6 @@ class FilterRunnerTest extends MediaWikiIntegrationTestCase {
|
|||
$changeTagger = $this->createMock( ChangeTagger::class );
|
||||
$changeTagger->expects( $this->once() )->method( 'addConditionsLimitTag' );
|
||||
$runner = $this->getRunner( $changeTagger, $cache );
|
||||
$this->assertTrue( $runner->run()->isGood() );
|
||||
$this->assertStatusGood( $runner->run() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ class FilterStoreTest extends MediaWikiIntegrationTestCase {
|
|||
$this->getTestSysop()->getUser(), $row['id'], $newFilter, $origFilter
|
||||
);
|
||||
|
||||
$this->assertTrue( $status->isGood(), "Save failed with status: $status" );
|
||||
$this->assertStatusGood( $status );
|
||||
$value = $status->getValue();
|
||||
$this->assertIsArray( $value );
|
||||
$this->assertCount( 2, $value );
|
||||
|
@ -154,9 +154,7 @@ class FilterStoreTest extends MediaWikiIntegrationTestCase {
|
|||
$this->overrideUserPermissions( $user, [ 'abusefilter-modify' ] );
|
||||
$status = AbuseFilterServices::getFilterStore()->saveFilter( $user, $row['id'], $newFilter, $origFilter );
|
||||
|
||||
$this->assertFalse( $status->isGood(), 'The filter validation returned a valid status.' );
|
||||
$actual = $status->getErrors()[0]['message'];
|
||||
$this->assertSame( $expectedError, $actual );
|
||||
$this->assertStatusWarning( $expectedError, $status );
|
||||
}
|
||||
|
||||
public function testSaveFilter_noChange() {
|
||||
|
@ -179,7 +177,7 @@ class FilterStoreTest extends MediaWikiIntegrationTestCase {
|
|||
$this->getTestSysop()->getUser(), $filter, $newFilter, $origFilter
|
||||
);
|
||||
|
||||
$this->assertTrue( $status->isGood(), "Got a non-good status: $status" );
|
||||
$this->assertStatusGood( $status );
|
||||
$this->assertFalse( $status->getValue(), 'Status value should be false' );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue