Page MenuHomePhabricator

MW 1.32+ "--with-phpunitclass" is gone
Closed, ResolvedPublic

Description

According to [0] "Remove the --with-phpunitclass feature since it doesn't work with this scheme." is no longer available which is very unfortunate since we do expect [1] it to be available to make some final clean-up after all tests (success or failure) have been completed before PHPUnit exists.

[0] https://github.com/wikimedia/mediawiki/commit/65adc3734846c685e511e22a2846f53e05e9d80c
[0] https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/457420/
[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/3392

Event Timeline

Looks like some pretty bad timing that the feature was removed just as you introduced something that uses it. :(

Generally tests should always tear down whatever they set up, so there shouldn't be a need for a final global teardown (theoretically at least). But in any case, maybe you could use a test listener (https://phpunit.de/manual/6.5/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener) and implement endTestSuite() ? It's not exactly identical since there are generally multiple suites being executed at once, but I think it might meet your needs.

P.S.: In the future, please always associate one project with new tasks. If you're not sure, you can always use the catch-all MediaWiki-General project. And if you're discussing a specific commit, it's good to CC the author/reviewer of the patch.

teardown (theoretically at least). But in any case, maybe you could use a test listener (https://phpunit.de/manual/6.5/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener) and implement endTestSuite() ? It's not exactly identical since there are generally multiple suites being executed at once, but I think it might meet your needs.

We already running a listener but that doesn't do what I need because it is invoked on each test (or suite) and not at the end of the entire run which is the point of overriding PHPUnitCommand::main as the last inception point before the exit.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/tests/phpunit/ExecutionTimeTestListener.php

Use register_shutdown_function?

mwjames claimed this task.

Use register_shutdown_function?

That should work as well [0].

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/3460