From e2b4ba368e05bd7137550f515da55ebcca9bfdae Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Tue, 29 Nov 2011 14:23:24 +0000 Subject: [PATCH] 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 :-( --- tests/testHelpers.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 ); -- 2.20.1