wiki.techinc.nl/tests/phpunit/includes/specials/SpecialUploadTest.php
Tim Starling 5e30a927bc tests: Make some PHPUnit data providers static
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.

Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.

Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
2023-03-24 02:53:57 +00:00

32 lines
764 B
PHP

<?php
use MediaWiki\MainConfigNames;
class SpecialUploadTest extends MediaWikiIntegrationTestCase {
/**
* @covers 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",
],
],
];
}
}