diff options
author | Bartosz Dziewoński <dziewonski@fastmail.fm> | 2024-08-12 21:26:59 +0200 |
---|---|---|
committer | Bartosz Dziewoński <dziewonski@fastmail.fm> | 2024-08-12 21:37:04 +0200 |
commit | 62cfede3fa77f5e79507ff7e62e185d7635beacf (patch) | |
tree | 07291e24fffa0e1036ddef48e63d91670595d071 /tests/phpunit/includes/exception/PermissionsErrorTest.php | |
parent | def22d80e9048c494ceca2db0627e0afca35fca7 (diff) | |
download | mediawikicore-62cfede3fa77f5e79507ff7e62e185d7635beacf.tar.gz mediawikicore-62cfede3fa77f5e79507ff7e62e185d7635beacf.zip |
PermissionsError: Deprecate public properties
Follow-up to 298ec8382b7914d128c1baaa88d011ca668e5207, which replaced
`public $errors` with `public $status`, causing T372181.
* Add a deprecated fallback getter/setter for $errors
* Make $permission private and add a deprecated getter/setter
* Make $status private
Bug: T372181
Change-Id: If44b2256289d6bde9e9abb901d9dc145555c971f
Diffstat (limited to 'tests/phpunit/includes/exception/PermissionsErrorTest.php')
-rw-r--r-- | tests/phpunit/includes/exception/PermissionsErrorTest.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/phpunit/includes/exception/PermissionsErrorTest.php b/tests/phpunit/includes/exception/PermissionsErrorTest.php index c68b8030e9c6..e94fe45e139d 100644 --- a/tests/phpunit/includes/exception/PermissionsErrorTest.php +++ b/tests/phpunit/includes/exception/PermissionsErrorTest.php @@ -2,6 +2,7 @@ use MediaWiki\Message\Message; use MediaWiki\Permissions\PermissionStatus; +use Wikimedia\TestingAccessWrapper; /** * @covers \PermissionsError @@ -32,8 +33,19 @@ class PermissionsErrorTest extends MediaWikiIntegrationTestCase { */ public function testConstruction( $permission, $errors, $expected ) { $e = new PermissionsError( $permission, $errors ); + $et = TestingAccessWrapper::newFromObject( $e ); + + $this->expectDeprecationAndContinue( '/Use of PermissionsError::\\$permission/' ); $this->assertEquals( $permission, $e->permission ); - $this->assertStatusMessagesExactly( $expected, $e->status ); + + $this->assertStatusMessagesExactly( $expected, $et->status ); + + $this->expectDeprecationAndContinue( '/Use of PermissionsError::\\$errors/' ); + $this->assertArrayEquals( $expected->toLegacyErrorArray(), $e->errors ); + + // Test the deprecated public property setter + $e->errors = $e->errors; + $this->assertStatusMessagesExactly( $expected, $et->status ); } public static function provideInvalidConstruction() { |