Why: * Maintenance scripts in core have low test coverage * This can cause issues such as the findDeprecated.php maintenance script not working, as described in T374832 * Testing the broken script after fixing it will avoid the script breaking again. What: * Fix the findDeprecated.php maintenance script to actually show when code is hard-deprecated. * Modify the script to allow mocking of the MediaWiki install path in PHPUnit tests * Create FindDeprecatedTest which tests that the script produces an expected output, without being specific about how the code finds the methods (to allow the method to be changed as discussed in T243403) ** To do this, create a folder in the data folder for the PHPUnit tests that has a mock file structure allowing the test to use a fixed list of soft and hard deprecated methods. Bug: T374832 Bug: T371167 Change-Id: Ic4933cef95ef1af7fa3939625ac1747106c71230
24 lines
435 B
PHP
24 lines
435 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Tests\Data\FindDeprecated;
|
|
|
|
/**
|
|
* Class without any deprecated code
|
|
*/
|
|
class FileWithoutDeprecatedCode {
|
|
/**
|
|
* This method is not deprecated :D
|
|
*
|
|
* @param string $param
|
|
* @return string
|
|
*/
|
|
public function testMethodOne( string $param ) {
|
|
return trim( $param );
|
|
}
|
|
|
|
public function testMethodTwo() {
|
|
// Call a wf* method that is not wfDeprecated.
|
|
wfDebug( "test" );
|
|
return "test";
|
|
}
|
|
}
|