3 namespace MediaWiki\Tests\Maintenance
;
5 use CommandLineInstaller
;
8 * @covers \CommandLineInstaller
11 class CommandLineInstallerTest
extends MaintenanceBaseTestCase
{
12 public function getMaintenanceClass() {
13 return CommandLineInstaller
::class;
16 public function testExecuteWhenHelpSpecified() {
17 $this->maintenance
->setOption( 'help', 1 );
18 // ::maybeShowHelp uses ->mName which is null unless we call this.
19 $this->maintenance
->setName( 'install.php' );
20 $this->expectCallToFatalError();
21 $this->expectOutputString( $this->maintenance
->getParameters()->getHelp() . "\n" );
22 $this->maintenance
->execute();
25 public function testExecuteWhenFirstArgumentProvidedButNotSecond() {
26 $this->maintenance
->setArg( 'name', 'mediawiki' );
27 // ::maybeShowHelp uses ->mName which is null unless we call this.
28 $this->maintenance
->setName( 'install.php' );
29 $this->expectCallToFatalError();
30 $this->expectOutputRegex( '/Argument \<admin\> is required/' );
31 $this->maintenance
->execute();