diff options
Diffstat (limited to 'MLEB/Translate/tests/phpunit/TranslateSandboxTest.php')
-rw-r--r-- | MLEB/Translate/tests/phpunit/TranslateSandboxTest.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/MLEB/Translate/tests/phpunit/TranslateSandboxTest.php b/MLEB/Translate/tests/phpunit/TranslateSandboxTest.php index c6f8b740..060f42a4 100644 --- a/MLEB/Translate/tests/phpunit/TranslateSandboxTest.php +++ b/MLEB/Translate/tests/phpunit/TranslateSandboxTest.php @@ -7,11 +7,13 @@ * @license GPL-2.0-or-later */ +use MediaWiki\MediaWikiServices; + /** * @group Database */ -class TranslateSandboxTest extends MediaWikiTestCase { - protected function setUp() { +class TranslateSandboxTest extends MediaWikiIntegrationTestCase { + protected function setUp() : void { parent::setUp(); $this->setMwGlobals( [ 'wgTranslateUseSandbox' => true, @@ -37,13 +39,11 @@ class TranslateSandboxTest extends MediaWikiTestCase { $this->assertFalse( $user->isLoggedIn(), 'User no longer exists' ); } - /** - * @expectedException MWException - * @expectedExceptionMessage Not a sandboxed user - */ public function testDeleteUserPromoted() { $user = TranslateSandbox::addUser( 'Test user3', 'test@blackhole.io', 'test password' ); TranslateSandbox::promoteUser( $user ); + $this->expectException( MWException::class ); + $this->expectExceptionMessage( 'Not a sandboxed user' ); TranslateSandbox::deleteUser( $user ); } @@ -92,14 +92,15 @@ class TranslateSandboxTest extends MediaWikiTestCase { public function testPermissions() { $user = TranslateSandbox::addUser( 'Test user7', 'test@blackhole.io', 'test password' ); $title = Title::makeTitle( NS_USER_TALK, $user->getName() ); + $pm = MediaWikiServices::getInstance()->getPermissionManager(); $this->assertFalse( - $title->userCan( 'edit', $user ), + $pm->userCan( 'edit', $user, $title ), 'Sandboxed users cannot edit their own talk page' ); TranslateSandbox::promoteUser( $user ); $this->assertTrue( - $title->userCan( 'edit', $user ), + $pm->userCan( 'edit', $user, $title ), 'Promoted users can edit their own talk page' ); } |