3 namespace MediaWiki\Tests\Maintenance
;
5 use MediaWiki\MainConfigNames
;
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';
13 * @covers \UpdateMediaWiki
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();