aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/specials/SpecialUploadTest.php
blob: 4c90daf517c2610e8f386895267525dee071717e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

use MediaWiki\MainConfigNames;
use MediaWiki\Specials\SpecialUpload;

class SpecialUploadTest extends MediaWikiIntegrationTestCase {
	/**
	 * @covers \MediaWiki\Specials\SpecialUpload::getInitialPageText
	 * @dataProvider provideGetInitialPageText
	 */
	public function testGetInitialPageText( $expected, $inputParams ) {
		$this->overrideConfigValue( MainConfigNames::LanguageCode, 'en' );
		$result = SpecialUpload::getInitialPageText( ...$inputParams );
		$this->assertEquals( $expected, $result );
	}

	public static function provideGetInitialPageText() {
		return [
			[
				'expect' => "== Summary ==\nthis is a test\n",
				'params' => [
					'this is a test'
				],
			],
			[
				'expect' => "== Summary ==\nthis is a test\n",
				'params' => [
					"== Summary ==\nthis is a test",
				],
			],
		];
	}
}