X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FSpecialPageTest.php;h=245cdffdd413d7d9d2aa10fee221a07ce7151424;hb=b52e1fe2f7e578a118a74f85cf20e5906432f662;hp=65057a57026ac1cdc6d0505e3cf0f9e223f31276;hpb=d53a645531aa7e73e72d46cf1d58cf7e97845cf0;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/SpecialPageTest.php b/tests/phpunit/includes/SpecialPageTest.php index 65057a5702..245cdffdd4 100644 --- a/tests/phpunit/includes/SpecialPageTest.php +++ b/tests/phpunit/includes/SpecialPageTest.php @@ -70,40 +70,30 @@ class SpecialPageTest extends MediaWikiTestCase { $this->setExpectedException( 'UserNotLoggedIn', $expected ); - if ( $reason === 'blank' && $title === 'blank' ) { - $specialPage->requireLogin(); - } else { - $specialPage->requireLogin( $reason, $title ); - } + // $specialPage->requireLogin( [ $reason [, $title ] ] ) + call_user_func_array( + array( $specialPage, 'requireLogin' ), + array_filter( array( $reason, $title ) ) + ); } public function requireLoginAnonProvider() { $lang = 'en'; - $msg = wfMessage( 'loginreqlink' )->inLanguage( $lang )->escaped(); - $loginLink = '' . $msg . ''; - - $expected1 = wfMessage( 'exception-nologin-text-manual' ) - ->params( $loginLink )->inLanguage( $lang )->text(); - + $expected1 = wfMessage( 'exception-nologin-text' )->inLanguage( $lang )->text(); $expected2 = wfMessage( 'about' )->inLanguage( $lang )->text(); return array( array( $expected1, null, null ), array( $expected2, 'about', null ), - array( $expected2, wfMessage( 'about' ), null ), array( $expected2, 'about', 'about' ), - array( $expected2, 'about', wfMessage( 'about' ) ), - array( $expected1, 'blank', 'blank' ) ); } public function testRequireLoginNotAnon() { $specialPage = new SpecialPage( 'Watchlist', 'viewmywatchlist' ); - $user = User::newFromId( 0 ); - $user->setId( 1 ); + $user = User::newFromName( "UTSysop" ); $specialPage->getContext()->setUser( $user ); $specialPage->requireLogin();