3 namespace MediaWiki\Tests\Maintenance
;
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 );
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() {
37 'No wikitext in the content' => [ 'testing1234', [], "<p>testing1234\n</p>" ],
38 'Wikitext in the content' => [ '* testing1234', [], '<ul><li>testing1234</li></ul>' ],