| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Maintenance; |
| 4 |
|
| 5 |
use CommandLineInstaller; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class CommandLineInstallerTest extends MaintenanceBaseTestCase { |
| 12 |
public function getMaintenanceClass() { |
| 13 |
return CommandLineInstaller::class; |
| 14 |
} |
| 15 |
|
| 16 |
public function testExecuteWhenHelpSpecified() { |
| 17 |
$this->maintenance->setOption( 'help', 1 ); |
| 18 |
|
| 19 |
$this->maintenance->setName( 'install.php' ); |
| 20 |
$this->expectCallToFatalError(); |
| 21 |
$this->expectOutputString( $this->maintenance->getParameters()->getHelp() . "\n" ); |
| 22 |
$this->maintenance->execute(); |
| 23 |
} |
| 24 |
|
| 25 |
public function testExecuteWhenFirstArgumentProvidedButNotSecond() { |
| 26 |
$this->maintenance->setArg( 'name', 'mediawiki' ); |
| 27 |
|
| 28 |
$this->maintenance->setName( 'install.php' ); |
| 29 |
$this->expectCallToFatalError(); |
| 30 |
$this->expectOutputRegex( '/Argument \<admin\> is required/' ); |
| 31 |
$this->maintenance->execute(); |
| 32 |
} |
| 33 |
} |