Le 05/12/13 14:49, Marcin Cieslak a écrit :
> I am not very happy about this but we came to the case
> where it might be useful to explicitly uninstall some
> hook(s) for out unit tests.
>  
> You might want to checkout MediaWikiTestCase::uninstallHook
> 
> https://gerrit.wikimedia.org/r/#/c/99349/
> 
> I am not happy about blurring differences between unit
> and integration testing, but breaking core with extensions
> and vice versa is sometimes useful.

For the context, that is about testing the MediaWiki core method
MWTimestamp::getHumanTimestamp().  Given a timestamp it returns
something that look more appealing to human.

There is a GetHumanTimestamp() that let you override the method
behaviour which is used by the cldr extension.

Hence, when running the MediaWiki core tests without any extension the
test pass but as soon as cldr is registered the behavior change and the
tests fails as expected.


What I would do instead is insert in the core test a feature that
detects something has been registered for GetHumanTimestamp hook and
skip the test entirely with a message like:

 "some extension registered GetHumanTimestamp hook altering the
behaviour of MWTimestamp::getHumanTimestamp(). Skipping test."

No need to hack the global imho.


(copy pasting above on Gerrit change).

-- 
Antoine "hashar" Musso


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

Reply via email to