| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Maintenance; |
| 4 |
|
| 5 |
use MediaWiki\MainConfigNames; |
| 6 |
use UpdateMediaWiki; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
require_once MW_INSTALL_PATH . '/maintenance/update.php'; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 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 |
|
| 31 |
|
| 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 |
} |