X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTitlePermissionTest.php;h=9121178a46e0211d3221828fb39f3557ba558bb8;hb=65f6c6d0d22db406c48b8747bbfaf63c27bf04cc;hp=a4d00596317da08016735e2501501873ef424260;hpb=601519ee36462faabacf4547c9aefaf7e8726476;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index a4d0059631..9121178a46 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -26,14 +26,10 @@ class TitlePermissionTest extends MediaWikiLangTestCase { protected function setUp() { parent::setUp(); - $langObj = Language::factory( 'en' ); $localZone = 'UTC'; $localOffset = date( 'Z' ) / 60; $this->setMwGlobals( [ - 'wgContLang' => $langObj, - 'wgLanguageCode' => 'en', - 'wgLang' => $langObj, 'wgLocaltimezone' => $localZone, 'wgLocalTZoffset' => $localOffset, 'wgNamespaceProtection' => [ @@ -52,7 +48,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase { if ( !isset( $this->userUser ) || !( $this->userUser instanceof User ) ) { $this->userUser = User::newFromName( $this->userName ); - if ( !$this->userUser->getID() ) { + if ( !$this->userUser->getId() ) { $this->userUser = User::createNew( $this->userName, [ "email" => "test@example.com", "real_name" => "Test User" ] ); @@ -60,7 +56,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase { } $this->altUser = User::newFromName( $this->altUserName ); - if ( !$this->altUser->getID() ) { + if ( !$this->altUser->getId() ) { $this->altUser = User::createNew( $this->altUserName, [ "email" => "alttest@example.com", "real_name" => "Test User Alt" ] ); @@ -662,7 +658,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase { $this->setUserPerm( [ "createpage" ] ); $this->setTitle( NS_MAIN, "test page" ); $this->title->mTitleProtection['permission'] = ''; - $this->title->mTitleProtection['user'] = $this->user->getID(); + $this->title->mTitleProtection['user'] = $this->user->getId(); $this->title->mTitleProtection['expiry'] = 'infinity'; $this->title->mTitleProtection['reason'] = 'test'; $this->title->mCascadeRestriction = false; @@ -791,5 +787,21 @@ class TitlePermissionTest extends MediaWikiLangTestCase { # $action != 'read' && $action != 'createaccount' && $user->isBlockedFrom( $this ) # $user->blockedFor() == '' # $user->mBlock->mExpiry == 'infinity' + + $this->user->mBlockedby = $this->user->getName(); + $this->user->mBlock = new Block( [ + 'address' => '127.0.8.1', + 'by' => $this->user->getId(), + 'reason' => 'no reason given', + 'timestamp' => $now, + 'auto' => false, + 'expiry' => 10, + 'systemBlock' => 'test', + ] ); + $this->assertEquals( [ [ 'systemblockedtext', + '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1', + 'Useruser', 'test', '23:00, 31 December 1969', '127.0.8.1', + $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ], + $this->title->getUserPermissionsErrors( 'move-target', $this->user ) ); } }