Debian Codegraph @

tests/phpunit/maintenance/UpdateMediaWikiTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Tests\Maintenance;
4
5 use MediaWiki\MainConfigNames;
6 use UpdateMediaWiki;
7
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';
11
12 /**
13 * @covers \UpdateMediaWiki
14 * @group Database
15 * @author Dreamy Jazz
16 */
17 class UpdateMediaWikiTest extends MaintenanceBaseTestCase {
18 public function getMaintenanceClass() {
19 return UpdateMediaWiki::class;
20 }
21
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();
27 }
28
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();
36 }
37 }