Closed MatmaRex closed 10 months ago
Thank you, this is so much cleaner than what I had to use. Tests passed in 1.38-1.41, so I will merge this after I drop 1.35 compatibility (planned soon, as MediaWiki 1.35 is EOL).
FILE: .../tests/phpunit/consequence/ModerationApproveHookTest.php 27 | WARNING | [x] Unused use statement "ScopedCallback" 28 | WARNING | [x] Unused use statement "TestingAccessWrapper"
Can you please remove these "use" statements at the beginning?
Done. I also made it skip the tests on earlier MediaWiki versions, as I realized you do that in other tests already.
This method is available since MediaWiki 1.38 (commit https://github.com/wikimedia/mediawiki/commit/84f0876b8302cd7d7ec727b2ed5daa49b6bddcc5 / https://gerrit.wikimedia.org/r/c/mediawiki/core/+/754117), and allows disabling the immediate execution of DeferredUpdates in a much simpler way. We've made similar changes to tests in MediaWiki itself in https://phabricator.wikimedia.org/T353247, and we're planning to deprecate using $wgCommandLineMode for this.
I realize that you still support MediaWiki 1.35, so I don't mind it if you leave this open for a few months or years :) until you want to drop compatibility. (Although I'm only changing tests, so if you don't run them against older versions any more, perhaps this can be merged already.)
I didn't run the tests locally, but I hope this works. Feel free to make changes if I broke something.