In the test suite, when one uses hideDeprecated(), the deprecated warning will be ignored for the rest of the test run. That can cause an unexpected deprecated warning when the tests are being run in a different order
I have hit that in REL1_30 which has WatchedItem methods deprecated (T182381). The suite has two tests cases:
WatchedItemIntegrationTest | hides deprecated |
WatchedItemUnitTest | does NOT hide them |
On CI they are executed in that order, hence the deprecated methods are already hidden when WatchedItemUnitTest is run. On my local machine, WatchedItemUnitTest got to run first and thus raised warnings failling the test run.
The fix was to copy paste the hideDeprecated() notice to WatchedItemUnitTest: https://gerrit.wikimedia.org/r/#/c/423469/
I guess whenever we use hideDeprecated(), we should make sure we reset the deprecation list. Possibly in MediaWikiTestCase::tearDown() by invoking MWDebug::clearLog() (though that also clear the log).
hideDeprecated has been introduced in a108dbfe8f7f20f22d6513838022d50bbdc17165.