mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-11 16:28:21 +00:00
Do not mock User in TextExtractorTest.
In I63d9807264d7e2295afef51fc9d982447f92fcbd we are changing how the permission checks are applied for revision, so it uses passed User instance as Authority. However, when user is mocked, the tests are breaking since the new user methods are not mocked. Pass a real user for now to fix the test. Once Authority reaches maturity and is ok to use in extensions, the test should be rewritten to use authority directly. Bug: T271458 Change-Id: Iacab813b253cc6e1439007e573e8ace06645860f
This commit is contained in:
parent
2e72e3a952
commit
6aa8f6f67b
|
@ -23,11 +23,7 @@ class TextExtractorTest extends MediaWikiIntegrationTestCase {
|
|||
* @dataProvider provideRevisionToString
|
||||
*/
|
||||
public function testRevisionToString( ?RevisionRecord $rev, bool $sysop, string $expected ) {
|
||||
$user = $this->createMock( User::class );
|
||||
$user->method( 'getName' )->willReturn( 'Test user 12345' );
|
||||
$perms = $sysop ? [ 'deletedtext' ] : [];
|
||||
$this->overrideUserPermissions( $user, $perms );
|
||||
|
||||
$user = $sysop ? $this->getTestSysop()->getUser() : $this->getTestUser()->getUser();
|
||||
$hookRunner = new AbuseFilterHookRunner( $this->createHookContainer() );
|
||||
$converter = new TextExtractor( $hookRunner );
|
||||
$actual = $converter->revisionToString( $rev, $user );
|
||||
|
|
Loading…
Reference in a new issue