Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / maintenance / CLIParserTest.php
blob390df6fc75fc5dd9ce6a3b29c00f118b1abfc237
1 <?php
3 namespace MediaWiki\Tests\Maintenance;
5 use CLIParser;
7 /**
8 * @covers \CLIParser
9 * @group Database
10 * @author Dreamy Jazz
12 class CLIParserTest extends MaintenanceBaseTestCase {
14 protected function getMaintenanceClass() {
15 return CLIParser::class;
18 /** @dataProvider provideExecute */
19 public function testExecute( $inputWikitext, $options, $expectedOutput ) {
20 foreach ( $options as $name => $value ) {
21 $this->maintenance->setOption( $name, $value );
23 // Get a file with the input wikitext as the content of the file and pass the filename
24 // to the maintenance script
25 $testFilename = $this->getNewTempFile();
26 $testFile = fopen( $testFilename, 'w' );
27 fwrite( $testFile, $inputWikitext );
28 fclose( $testFile );
29 $this->maintenance->setArg( 'file', $testFilename );
30 // Run the maintenance script and expect that the output is the expected HTML
31 $this->maintenance->execute();
32 $this->expectOutputString( $expectedOutput );
35 public static function provideExecute() {
36 return [
37 'No wikitext in the content' => [ 'testing1234', [], "<p>testing1234\n</p>" ],
38 'Wikitext in the content' => [ '* testing1234', [], '<ul><li>testing1234</li></ul>' ],