diff --git a/tests/phpunit/includes/specialpage/FormSpecialPageTestCase.php b/tests/phpunit/includes/specialpage/FormSpecialPageTestCase.php index e634130225f..51ff18b45ac 100644 --- a/tests/phpunit/includes/specialpage/FormSpecialPageTestCase.php +++ b/tests/phpunit/includes/specialpage/FormSpecialPageTestCase.php @@ -44,9 +44,6 @@ abstract class FormSpecialPageTestCase extends SpecialPageTestBase { * @covers \MediaWiki\SpecialPage\FormSpecialPage::checkExecutePermissions */ public function testCheckExecutePermissionsSitewideBlock() { - $special = $this->newSpecialPage(); - $checkExecutePermissions = $this->getMethod( $special, 'checkExecutePermissions' ); - $blockErrorFormatter = $this->createMock( BlockErrorFormatter::class ); $blockErrorFormatter->method( 'getMessage' ) ->willReturn( $this->getMockMessage( 'test' ) ); @@ -57,6 +54,9 @@ abstract class FormSpecialPageTestCase extends SpecialPageTestBase { $permissionManager->method( 'userHasRight' )->willReturn( true ); $this->setService( 'PermissionManager', $permissionManager ); + $special = $this->newSpecialPage(); + $checkExecutePermissions = $this->getMethod( $special, 'checkExecutePermissions' ); + $user = $this->getMockBuilder( User::class ) ->onlyMethods( [ 'getBlock', 'getWikiId' ] ) ->getMock(); @@ -75,9 +75,6 @@ abstract class FormSpecialPageTestCase extends SpecialPageTestBase { * @covers \MediaWiki\SpecialPage\FormSpecialPage::checkExecutePermissions */ public function testCheckExecutePermissionsPartialBlock() { - $special = $this->newSpecialPage(); - $checkExecutePermissions = $this->getMethod( $special, 'checkExecutePermissions' ); - $blockErrorFormatter = $this->createMock( BlockErrorFormatter::class ); $blockErrorFormatter->method( 'getMessage' ) ->willReturn( $this->getMockMessage( 'test' ) ); @@ -92,6 +89,9 @@ abstract class FormSpecialPageTestCase extends SpecialPageTestBase { $permissionManager->method( 'userHasRight' )->willReturn( true ); $this->setService( 'PermissionManager', $permissionManager ); + $special = $this->newSpecialPage(); + $checkExecutePermissions = $this->getMethod( $special, 'checkExecutePermissions' ); + $user = $this->getMockBuilder( User::class ) ->onlyMethods( [ 'getBlock', 'getWikiId' ] ) ->getMock();