Hey,
I updated one of my extensions to use PHPUnit 6+ and am having troubles getting the tests to run with older versions of MediaWiki. In particular, I'd like my tests to run with MW 1.27. I suspect this is somehow possible and has already been done in other extensions.
Cheers
-- Jeroen De Dauw | https://entropywins.wtf | https://keybase.io/jeroendedauw Software Crafter | Speaker | Student | Strategist | Contributor to Wikimedia and Open Source ~=[,,_,,]:3
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi,
On 05/12/2018 11:37 PM, Jeroen De Dauw wrote:
I updated one of my extensions to use PHPUnit 6+ and am having troubles getting the tests to run with older versions of MediaWiki. In particular, I'd like my tests to run with MW 1.27. I suspect this is somehow possible and has already been done in other extensions.
Which extension specifically, and what trouble did you run into? Can you provide a link to the code/tests?
- -- Legoktm
Hey Legoktm,
This is for the Maps extension, though I will also need to deal with this elsewhere.
Failing tests: https://travis-ci.org/JeroenDeDauw/Maps/builds/375344161
Code: https://github.com/JeroenDeDauw/Maps
I'd be ideal to have the older versions of MediaWiki use PHPUnit 6.x or later, but I've not found a way to do so yet.
Cheers
-- Jeroen De Dauw | https://entropywins.wtf | https://keybase.io/jeroendedauw Software Crafter | Speaker | Student | Strategist | Contributor to Wikimedia and Open Source ~=[,,_,,]:3
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi,
On 05/15/2018 11:25 PM, Jeroen De Dauw wrote:
Failing tests: https://travis-ci.org/JeroenDeDauw/Maps/builds/375344161
OK, so you need to use the PHPUnit4And6Compat trait as explained in[1]. That polyfills the setExpectedException() method that was removed in PHPUnit 6. Since you want to support older MediaWiki versions that don't have the trait, if you write your tests expecting PHPUnit 4 and leave a dummy trait in place for older versions, it should work out.
I submitted this as a PR at [2]. Whenever you stop testing against pre-1.31 versions of MediaWiki, you can drop the trait and write your tests expecting PHPUnit 6.
That said, it looks like master of the Maps extension isn't actually running any tests against older versions of MediaWiki, they all seem to report "No tests executed!"[3].
I'd be ideal to have the older versions of MediaWiki use PHPUnit 6.x or later, but I've not found a way to do so yet.
You'd have to backport the PHPUnit4And6Compat trait as well as the autoloader aliasing[4].
[1] https://lists.wikimedia.org/pipermail/wikitech-l/2018-April/089766.html [2] https://github.com/JeroenDeDauw/Maps/pull/424 [3] https://travis-ci.org/JeroenDeDauw/Maps/jobs/378261536 [4] https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/t ests/common/TestsAutoLoader.php#191
- -- Legoktm
wikitech-l@lists.wikimedia.org