Last modified: 2014-11-19 21:52:56 UTC
MediaWiki needs a (voting) sniff to ensure the test conventions[1]: Data providers must be public static functions [1]http://www.mediawiki.org/wiki/Manual:PHP_unit_testing/Writing_unit_tests#Test_conventions See also bug 46434
Maybe we can implement a unit test in tests/phpunit/StructureTest.php
The sniff should assert: * setUp/tearDown is "protected static function" * test function is "public function" * dataProvider is "public static function" And maybe: * setUp/tearDown should call parent method (not sure about the latter, I think there are some cases were we genuinely don't)
The convention has been added by Timo Revision as of 01:20, 6 October 2012 http://www.mediawiki.org/w/index.php?title=Manual:PHP_unit_testing/Writing_unit_tests&diff=591076&oldid=586470 I am not sure what is the rational behind it. Anyway, it should be possible to enhance MediaWikiTestCase to call a PHPUnit method that would gives out all the @dataprovider statements and then check whether they are public static methods.