MinervaPagePermissionsTest: Remove unused parameter in buildPermissionsObject

Change-Id: Iaf0ec206a05b809edccb6e64ec3706a4c60faf84
This commit is contained in:
Fomafix 2024-02-28 08:01:32 +00:00
parent 3bb9611497
commit 56bef8120f

View file

@ -30,7 +30,6 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
private function buildPermissionsObject( private function buildPermissionsObject(
Title $title, Title $title,
$actions = null, /* unused */
array $options = [], array $options = [],
ContentHandler $contentHandler = null, ContentHandler $contentHandler = null,
Authority $user = null, Authority $user = null,
@ -41,15 +40,6 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
->willReturn( $hasOtherLanguagesOrVariants ); ->willReturn( $hasOtherLanguagesOrVariants );
$user ??= $this->mockRegisteredNullAuthority(); $user ??= $this->mockRegisteredNullAuthority();
$actions ??= [
IMinervaPagePermissions::CONTENT_EDIT,
IMinervaPagePermissions::WATCH,
IMinervaPagePermissions::TALK,
IMinervaPagePermissions::SWITCH_LANGUAGE,
IMinervaPagePermissions::MOVE,
IMinervaPagePermissions::DELETE,
IMinervaPagePermissions::PROTECT,
];
$contentHandler = $contentHandler ?? $contentHandler = $contentHandler ??
$this->getMockForAbstractClass( ContentHandler::class, [], '', false ); $this->getMockForAbstractClass( ContentHandler::class, [], '', false );
$skinOptions = new SkinOptions(); $skinOptions = new SkinOptions();
@ -86,7 +76,7 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
*/ */
public function testWatchAndEditNotAllowedOnMainPage() { public function testWatchAndEditNotAllowedOnMainPage() {
$user = $this->mockAnonNullAuthority(); $user = $this->mockAnonNullAuthority();
$permsAnon = $this->buildPermissionsObject( Title::newMainPage(), null, [], null, $user ); $permsAnon = $this->buildPermissionsObject( Title::newMainPage(), [], null, $user );
$perms = $this->buildPermissionsObject( Title::newMainPage() ); $perms = $this->buildPermissionsObject( Title::newMainPage() );
$this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::WATCH ) ); $this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::WATCH ) );
@ -102,7 +92,7 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
* @covers ::isAllowed * @covers ::isAllowed
*/ */
public function testInvalidPageActionsArentAllowed() { public function testInvalidPageActionsArentAllowed() {
$perms = $this->buildPermissionsObject( Title::makeTitle( NS_MAIN, 'Test' ), [] ); $perms = $this->buildPermissionsObject( Title::makeTitle( NS_MAIN, 'Test' ) );
$this->assertFalse( $perms->isAllowed( 'blah' ) ); $this->assertFalse( $perms->isAllowed( 'blah' ) );
$this->assertFalse( $perms->isAllowed( 'wah' ) ); $this->assertFalse( $perms->isAllowed( 'wah' ) );
@ -114,7 +104,6 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
public function testValidPageActionsAreAllowed() { public function testValidPageActionsAreAllowed() {
$perms = $this->buildPermissionsObject( $perms = $this->buildPermissionsObject(
Title::makeTitle( NS_MAIN, 'Test' ), Title::makeTitle( NS_MAIN, 'Test' ),
null,
[], [],
null, null,
$this->mockRegisteredUltimateAuthority() $this->mockRegisteredUltimateAuthority()
@ -152,7 +141,7 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
$contentHandler->method( 'supportsDirectApiEditing' ) $contentHandler->method( 'supportsDirectApiEditing' )
->willReturn( $supportsDirectApiEditing ); ->willReturn( $supportsDirectApiEditing );
$perms = $this->buildPermissionsObject( Title::makeTitle( NS_MAIN, 'Test' ), null, [], $perms = $this->buildPermissionsObject( Title::makeTitle( NS_MAIN, 'Test' ), [],
$contentHandler ); $contentHandler );
$this->assertEquals( $expected, $perms->isAllowed( IMinervaPagePermissions::CONTENT_EDIT ) ); $this->assertEquals( $expected, $perms->isAllowed( IMinervaPagePermissions::CONTENT_EDIT ) );
@ -230,7 +219,6 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
] ); ] );
$permissions = $this->buildPermissionsObject( $permissions = $this->buildPermissionsObject(
$title, $title,
null,
[], [],
null, null,
null, null,
@ -281,7 +269,7 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
* @covers ::isAllowed * @covers ::isAllowed
*/ */
public function testMoveAndDeleteAndProtectNotAllowedByDefault() { public function testMoveAndDeleteAndProtectNotAllowedByDefault() {
$perms = $this->buildPermissionsObject( Title::makeTitle( NS_MAIN, 'Test' ), null ); $perms = $this->buildPermissionsObject( Title::makeTitle( NS_MAIN, 'Test' ) );
$this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::MOVE ) ); $this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::MOVE ) );
$this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::DELETE ) ); $this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::DELETE ) );
$this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::PROTECT ) ); $this->assertFalse( $perms->isAllowed( IMinervaPagePermissions::PROTECT ) );
@ -301,15 +289,6 @@ class MinervaPagePermissionsTest extends MediaWikiIntegrationTestCase {
$perms = $this->buildPermissionsObject( $perms = $this->buildPermissionsObject(
$title, $title,
[
IMinervaPagePermissions::CONTENT_EDIT,
IMinervaPagePermissions::WATCH,
IMinervaPagePermissions::TALK,
IMinervaPagePermissions::SWITCH_LANGUAGE,
IMinervaPagePermissions::MOVE,
IMinervaPagePermissions::DELETE,
IMinervaPagePermissions::PROTECT,
],
[], [],
null, null,
$this->mockRegisteredUltimateAuthority() $this->mockRegisteredUltimateAuthority()