PHPUnit 6+ on older versions of MW

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PHPUnit 6+ on older versions of MW

Jeroen De Dauw-2
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
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: PHPUnit 6+ on older versions of MW

Kunal Mehta
-----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
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE+h6fmkHn9DUCyl1jUvyOe+23/KIFAlr4kmEACgkQUvyOe+23
/KJIlg//ezqe4gq1ltOZ7C/+RGtw5r6xi1agjmpDcykkJD0hrdKk54GcIHJRQiGJ
FapAe6JFM31KCjgkVC8vJOBZhkkdSjjleelboEvInF0kHhpeVcFgmdcMVMayOUpu
l/IXHr080yc/2HI9F+QkxePgKd8cGPpDDhV69vFc5H49qOJh+xfiMNFJQxDroNYR
ECw/w7vRkyJ6OfN8bw6PzXxIDZl2QnPEWGL6y9JRsCKdFiewiwkd07IK3NDqv97Q
0ZiY/cc/MCeIg+ziZrjgeIiC8ImkRp99RKuxTlpg8wgSTtg2xlFW1V2xbL5cqml/
FFEETGav4JETOyMNkR3MTRX7FUL76TatmVOL4PExxoimYVhxryFdTL7kpSAELax/
4olD7ju13cCmam8/jVvhrWW7TXvqAyHB16kyWTnt2nLYKLTSq6K77vKXY1RrKG7n
OuGP+bTjWkddvghbBW3d9h93jbFJKJlLcKbaUy9Au5aWf56SmXoAsRWUu8/J2C9M
tTLzz4LuR8/XfCqvQb3LS2jO3eVNvSFzaE9qIit7OmRCRI60m3Oh/DB1L1h3PzwA
onEgeUayfdOiAMzT+VeMne4kjZifLQusZs8hSPsKslrJwR4Hy950st1it9nSUE7O
+p7eQCLxSbwo3Mo/imf9AkSB7yC1ZacQmMEpdFGWdL407vd1gCU=
=2OTy
-----END PGP SIGNATURE-----

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: PHPUnit 6+ on older versions of MW

Jeroen De Dauw-2
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
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: PHPUnit 6+ on older versions of MW

Kunal Mehta
-----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
>
> Code: https://github.com/JeroenDeDauw/Maps

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
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE+h6fmkHn9DUCyl1jUvyOe+23/KIFAlr86EIACgkQUvyOe+23
/KJ+MA/+KseYsMrpvAeQWBQq31I7WcGCQWHQGPNRrAQtnPIbIc+IlfoS3+wNmB/J
m1TSSzj20pAtqwvGB/dJsoER/LJRKWdSXWeYSpKIm7xtEfK1qdVqSlbsgeHVBC+/
HnK6MRxExZwL1p0IpWsJIdt7q7+dIx7CBrVqOIe1f6DZRO+pKatZrTNiEUOAzawr
GayLMFmL37J66sV/eMTTMB30iJJG3WZow0TvtHnhhTdl4f3jVFpQC2DVgSsGAKa0
x89G3gTOPo3kP+3wYt8T+2gO4li/V75RPdA2ZJnDCNDdwPoM3RDb+AnVTefSbTXS
0q5JITOvRzxb4kXiXDIEFv6DHuKhTjJMAQKBWj+cHbnZTXM0ot2HCEsAHMnyJggD
p6xCP8y4EP8fu0dH5+bWhgcWKD8pr1kA2gMFHFmXVgc1dTVrH1L4n8VDIeJcX2IK
Xp96GD4rSEC3hiZ0BJLrWSltFqQf5bj9HCqOmbkBRm85/cD0C+APferrfPr5USgV
gqBf1vjjAoz76ctobqLG6eli6DRSjjIR5pqvNKkJyFA5vRt2uqWnCXownmHlCT/a
HPYh2AmGK+NAJZKwDtYS9sPClQ671BlpeMOp94ASB24bKkOqyapPr5pu1hukN3oG
z+kB+u5GP50dsXM03kq3h3+Ful62Etrnc6ydbilh5csZzgUREBs=
=+jql
-----END PGP SIGNATURE-----

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l