thiemowmde created this task.
thiemowmde added projects: Wikidata, DataValues, Technical-Debt.
Herald added a subscriber: Aklapper.

TASK DESCRIPTION

PHPUnit backported namespaced class names from PHPUnit 6 back to the older versions 4 and 5. We can start using these right now. This will make the later migration to PHPUnit 6 quite a lot easier, as the necessary patches will be much smaller.

In contrast to what the changelog states, PHPUnit 4.8.35 introduced these aliases:

  • PHPUnit_Framework_AssertAssert
  • PHPUnit_Framework_BaseTestListenerBaseTestListener
  • PHPUnit_Framework_TestCaseTestCase
  • PHPUnit_Framework_TestListenerTestListener

In addition, PHPUnit 4.8.36 introduced these aliases:

  • PHPUnit_Framework_AssertionFailedErrorAssertionFailedError
  • PHPUnit_Framework_TestTest
  • PHPUnit_Framework_TestSuiteTestSuite

The suggestion is to not care about any of these, but exclusively focus on replacing PHPUnit_Framework_TestCase with TestCase. This is the vast majority of replacements we need to do (about 84% when I count appearances in my local codebase, with the next one being 7% of PHPUnit_Framework_MockObject_MockObject). Focusing on this one class will make reviewing patches easier. All the other updates can be done later when actually updating to PHPUnit 6.

The suggestion is to not replace … extends \PHPUnit_Framework_TestCase with … extends \PHPUnit\Framework\TestCase, but with … extends TestCase and an import in the use section above. This fits better to the code style the Wikidata team is used to, where full qualified class names are avoided.

If a code base requires it's own PHPUnit version (this is the case for all PHP components that are not MediaWiki extensions), the suggestion is to go for this dependency in composer.json:

"phpunit/phpunit": "^4.8.35|^6",

List of components that need an update:

  • TBD

TASK DETAIL
https://phabricator.wikimedia.org/T188011

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: thiemowmde
Cc: Jonas, Lucas_Werkmeister_WMDE, WMDE-leszek, Ladsgroup, thiemowmde, Aklapper, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Wikidata-bugs, aude, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to