-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi,
tl;dr: Read the "So what do you need to do?" section
We're currently in the process of upgrading the MediaWiki PHPUnit version to 6. To avoid an immediate breaking change, we will be doing this transition in two steps. First, we will start running tests with both PHPUnit 4 and 6 (next week), using a compatibility layer to support both. Then at some point during the 1.32 or 1.33 release cycles, we'll drop the compatibility layer and just support 6 (and maybe a later version too?).
There are two parts to the compatibility layer. First, an autoloader hack aliases most of the old PHPUnit_Framework_Whatever classes to the new namespaced versions, PHPUnit\Framework\Whatever. This allows tests that use the old class names to continue to work, without any modification. The second part is a trait, PHPUnit4And6Compat, which provides implementations of the getMock() and setExpectedException() functions that were removed in PHPUnit 6. It also has a forward-port of the new createMock() replacement. MediaWikiTestCase uses this trait by default
So what do you need to do? First, run your extension tests locally against PHPUnit 6. Edit MediaWiki core's composer.json's dependency on phpunit/phpunit to say "^6.5", run composer update, and then run your extension's tests. If you run into issues about getMock/setExpectedException, then you probably need to add "use PHPUnit4And6Compat;" to your test class. See [1] for an example. Other problems could relate to some class names changing. If you get stuck, please cc or ping me and I can take a look.
I'd like to start running voting tests against PHPUnit 4 and 6 next week on Thursday (April 12). This should give us just enough time to fix any resulting issues before the 1.31 branch.
[1] https://gerrit.wikimedia.org/r/#/c/424843/
Thanks, - -- Kunal / Legoktm
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi,
On 04/07/2018 09:03 PM, Kunal Mehta wrote:
I'd like to start running voting tests against PHPUnit 4 and 6 next week on Thursday (April 12). This should give us just enough time to fix any resulting issues before the 1.31 branch.
We ran into a few[1] issues today, but are all ready to merge the upgrade to PHPUnit 6[2] tomorrow (Friday April 13). I suspect that very few people actually tested their extensions against PHPUnit 6 - so we'll just see what the fallout is and fix broken extensions as they come up. Thanks to Anomie, James F, and Krinkle for addressing failures and reviewing patches today, and Hashar for helping with Jenkins :-)
So far the main problem areas that cause failures are: * Using getMock/setExpectedException without the back-compat layer * Trying to mock methods that no longer exist (or never did) * Tests that don't assert anything and are risky
[1] https://gerrit.wikimedia.org/r/#/q/topic:phpunit-6 [2] https://gerrit.wikimedia.org/r/#/c/394851/
- -- Legoktm
wikitech-l@lists.wikimedia.org