Last modified: 2014-11-19 21:52:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T48483, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 46483 - Jenkins: Create phpcs sniff to ensure test functions have the proper signature
Jenkins: Create phpcs sniff to ensure test functions have the proper signature
Status: NEW
Product: Wikimedia
Classification: Unclassified
Continuous integration (Other open bugs)
wmf-deployment
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-23 09:33 UTC by db [inactive,noenotif]
Modified: 2014-11-19 21:52 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description db [inactive,noenotif] 2013-03-23 09:33:06 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
Comment 1 Antoine "hashar" Musso (WMF) 2013-03-23 10:49:29 UTC
Maybe we can implement a unit test in tests/phpunit/StructureTest.php
Comment 2 Krinkle 2013-06-25 18:49:17 UTC
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)
Comment 3 Antoine "hashar" Musso (WMF) 2013-06-25 19:00:01 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links