Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / maintenance / UpdateMediaWikiTest.php
blob191b6a6fe47973c8e25a2ff137d87a4dc2d76f59
1 <?php
3 namespace MediaWiki\Tests\Maintenance;
5 use MediaWiki\MainConfigNames;
6 use UpdateMediaWiki;
8 // UpdateMediaWiki is not autoloaded, and therefore we need to load the file here. Using require_once should
9 // be enough to achieve this.
10 require_once MW_INSTALL_PATH . '/maintenance/update.php';
12 /**
13 * @covers \UpdateMediaWiki
14 * @group Database
15 * @author Dreamy Jazz
17 class UpdateMediaWikiTest extends MaintenanceBaseTestCase {
18 public function getMaintenanceClass() {
19 return UpdateMediaWiki::class;
22 public function testExecuteWhenAllowSchemaUpdatesSetToFalse() {
23 $this->overrideConfigValue( MainConfigNames::AllowSchemaUpdates, false );
24 $this->expectCallToFatalError();
25 $this->expectOutputRegex( '/Do not run update\.php on this wiki/' );
26 $this->maintenance->execute();
29 public function testExecuteWhenUsingInvalidConfig() {
30 // Set wgAutoCreateTempUser to true to simulate that an invalid config has been set in LocalSettings.php.
31 // wgAutoCreateTempUser should normally be an array and a boolean value is invalid for this configuration.
32 $this->overrideConfigValue( MainConfigNames::AutoCreateTempUser, true );
33 $this->expectCallToFatalError();
34 $this->expectOutputRegex( '/Some of your configuration settings caused a warning[\s\S]*AutoCreateTempUser/' );
35 $this->maintenance->execute();