From: Antoine Musso Date: Tue, 29 Nov 2011 14:23:24 +0000 (+0000) Subject: Fix fatal error when running newParserTest X-Git-Tag: 1.31.0-rc.0~26231 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=e2b4ba368e05bd7137550f515da55ebcca9bfdae;p=lhc%2Fweb%2Fwiklou.git Fix fatal error when running newParserTest The delayed parser test feature was expecting a ParserTest object which is almost never the case when using the NewParserTest for PHPUnit. The class name is forged after the file name! They at least all extends NewParserTest no polymorphism? no multiple hinting. Be creative the PHP way by writing your own code :-( --- diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index 1cd611f6a1..761898691d 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -543,7 +543,12 @@ class DelayedParserTest { * Called whenever we actually want to run the hook. * Should be the case if we found the parserTest is not disabled */ - public function unleash( ParserTest &$parserTest ) { + public function unleash( &$parserTest ) { + if( !($parserTest instanceof ParserTest || $parserTest instanceof NewParserTest + ) ) { + throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or NewParserTest classes\n" ); + } + # Trigger delayed hooks. Any failure will make us abort foreach( $this->hooks as $hook ) { $ret = $parserTest->requireHook( $hook );