wiki.techinc.nl/tests/phpunit/data/FindDeprecated/includes/FileWithDeprecatedCode.php
Dreamy Jazz e2b6281d6d Test findDeprecated.php
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
2024-10-15 17:08:23 +00:00

20 lines
366 B
PHP

<?php
namespace MediaWiki\Tests\Data\FindDeprecated;
class FileWithDeprecatedCode {
/** @deprecated Since 1.43 */
public function testMethodOne() {
return 'abc';
}
/** @deprecated 1.44 */
public static function testMethodTwo() {
wfDeprecated( __METHOD__, '1.44' );
return 'def';
}
public function testMethodThree() {
return 'not deprecated';
}
}