From: jenkins-bot Date: Fri, 6 May 2016 18:33:13 +0000 (+0000) Subject: Merge "registration: Fix mode of files (755 -> 644)" X-Git-Tag: 1.31.0-rc.0~7070 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=86d744382749e855fcc1bbb5f7bc7cb2a3cbb810;hp=5d2df74a468529fd396efc403c2decb1c504edc4;p=lhc%2Fweb%2Fwiklou.git Merge "registration: Fix mode of files (755 -> 644)" --- diff --git a/includes/specials/SpecialChangeContentModel.php b/includes/specials/SpecialChangeContentModel.php index ee9f665bbd..c7a650cca6 100644 --- a/includes/specials/SpecialChangeContentModel.php +++ b/includes/specials/SpecialChangeContentModel.php @@ -84,12 +84,20 @@ class SpecialChangeContentModel extends FormSpecialPage { ], ]; if ( $this->title ) { + $options = $this->getOptionsForTitle( $this->title ); + if ( empty( $options ) ) { + throw new ErrorPageError( + 'changecontentmodel-emptymodels-title', + 'changecontentmodel-emptymodels-text', + $this->title->getPrefixedText() + ); + } $fields['pagetitle']['readonly'] = true; $fields += [ 'model' => [ 'type' => 'select', 'name' => 'model', - 'options' => $this->getOptionsForTitle( $this->title ), + 'options' => $options, 'label-message' => 'changecontentmodel-model-label' ], 'reason' => [ diff --git a/languages/i18n/en.json b/languages/i18n/en.json index ce68e94ad8..a521ab5a77 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2133,6 +2133,8 @@ "changecontentmodel-success-text": "The content type of [[:$1]] has been changed.", "changecontentmodel-cannot-convert": "The content on [[:$1]] cannot be converted to a type of $2.", "changecontentmodel-nodirectediting": "The $1 content model does not support direct editing", + "changecontentmodel-emptymodels-title": "No content models available", + "changecontentmodel-emptymodels-text": "The content on [[:$1]] cannot be converted to any type.", "log-name-contentmodel": "Content model change log", "log-description-contentmodel": "Events related to the content models of a page", "logentry-contentmodel-new": "$1 {{GENDER:$2|created}} the page $3 using a non-default content model \"$5\"", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 94dc4aa18d..ce019cf71c 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2311,6 +2311,8 @@ "changecontentmodel-success-text": "Message telling user that their change has been successfully done.\n* $1 - Target page title", "changecontentmodel-cannot-convert": "Error message shown if the content model cannot be changed to the specified type. $1 is the page title, $2 is the localized content model name.", "changecontentmodel-nodirectediting": "Error message shown if the content model does not allow for direct editing. $1 is the localized name of the content model.", + "changecontentmodel-emptymodels-title": "Title of the error page shown if the content model cannot be changed to any of the available types.", + "changecontentmodel-emptymodels-text": "Text of the error page shown if the content model cannot be changed to any of the available types. $1 is the page title.", "log-name-contentmodel": "{{doc-logpage}}\n\nTitle of [[Special:Log/contentmodel]].", "log-description-contentmodel": "Text in [[Special:Log/contentmodel]].", "logentry-contentmodel-new": "{{Logentry}}\n$4 is not used.\n$5 is the new content model.", diff --git a/languages/messages/MessagesCs.php b/languages/messages/MessagesCs.php index ee04481d37..e54c4a700b 100644 --- a/languages/messages/MessagesCs.php +++ b/languages/messages/MessagesCs.php @@ -56,7 +56,7 @@ $specialPageAliases = [ 'BrokenRedirects' => [ 'Přerušená_přesměrování', 'Prerusena_presmerovani' ], 'Categories' => [ 'Kategorie' ], 'ChangeEmail' => [ 'Změna_emailu', 'Zmena_emailu' ], - 'ChangePassword' => [ 'Změna_hesla', 'Zmena_hesla', 'Resetovat_heslo' ], + 'ChangePassword' => [ 'Změna_hesla', 'Zmena_hesla' ], 'ComparePages' => [ 'Porovnání_stránek', 'PorovnáníStránek', 'Porovnani_stranek', 'PorovnaniStranek' ], 'Confirmemail' => [ 'Potvrdit_e-mail' ], 'Contributions' => [ 'Příspěvky', 'Prispevky' ], @@ -98,6 +98,7 @@ $specialPageAliases = [ 'Mytalk' => [ 'Moje_diskuse' ], 'Newimages' => [ 'Nové_obrázky', 'Galerie_nových_obrázků', 'Nove_obrazky' ], 'Newpages' => [ 'Nové_stránky', 'Nove_stranky', 'Nejnovější_stránky', 'Nejnovejsi_stranky' ], + 'PasswordReset' => [ 'Reset_hesla', 'Resetovat_heslo' ], 'Preferences' => [ 'Nastavení', 'Nastaveni' ], 'Protectedpages' => [ 'Zamčené_stránky', 'Zamcene_stranky' ], 'Protectedtitles' => [ 'Zamčené_názvy', 'Zamcene_nazvy', 'Stránky_které_nelze_vytvořit' ], diff --git a/tests/phpunit/includes/TestUser.php b/tests/phpunit/includes/TestUser.php index b506cb87af..142c77f932 100644 --- a/tests/phpunit/includes/TestUser.php +++ b/tests/phpunit/includes/TestUser.php @@ -143,6 +143,7 @@ class TestUser { } /** + * @since 1.25 * @return User */ public function getUser() { @@ -150,6 +151,7 @@ class TestUser { } /** + * @since 1.25 * @return string */ public function getPassword() { diff --git a/tests/phpunit/tests/MediaWikiTestCaseTest.php b/tests/phpunit/tests/MediaWikiTestCaseTest.php index 955dd2fb67..5d2f37e6a6 100644 --- a/tests/phpunit/tests/MediaWikiTestCaseTest.php +++ b/tests/phpunit/tests/MediaWikiTestCaseTest.php @@ -1,5 +1,6 @@ stashMwGlobals( self::GLOBAL_KEY_NONEXISTING ); } + public function testOverrideMwServices() { + $initialServices = MediaWikiServices::getInstance(); + + $this->overrideMwServices(); + $this->assertNotSame( $initialServices, MediaWikiServices::getInstance() ); + + $this->tearDown(); + $this->assertSame( $initialServices, MediaWikiServices::getInstance() ); + } + + public function testSetService() { + $initialServices = MediaWikiServices::getInstance(); + $initialService = $initialServices->getDBLoadBalancer(); + $mockService = $this->getMockBuilder( LoadBalancer::class ) + ->disableOriginalConstructor()->getMock(); + + $this->setService( 'DBLoadBalancer', $mockService ); + $this->assertNotSame( $initialServices, MediaWikiServices::getInstance() ); + $this->assertNotSame( + $initialService, + MediaWikiServices::getInstance()->getDBLoadBalancer() + ); + $this->assertSame( $mockService, MediaWikiServices::getInstance()->getDBLoadBalancer() ); + + $this->tearDown(); + $this->assertSame( $initialServices, MediaWikiServices::getInstance() ); + $this->assertNotSame( $mockService, MediaWikiServices::getInstance()->getDBLoadBalancer() ); + $this->assertSame( $initialService, MediaWikiServices::getInstance()->getDBLoadBalancer() ); + } + /** * @covers MediaWikiTestCase::setLogger * @covers MediaWikiTestCase::restoreLogger