Debian Codegraph @

tests/phpunit/maintenance/CommandLineInstallerTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Tests\Maintenance;
4
5 use CommandLineInstaller;
6
7 /**
8 * @covers \CommandLineInstaller
9 * @author Dreamy Jazz
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 // ::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();
23 }
24
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();
32 }
33 }