From: Tim Starling Date: Thu, 6 Oct 2016 05:41:15 +0000 (+1100) Subject: parserTests: Use a mock parser during article insertion X-Git-Tag: 1.31.0-rc.0~4857^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=65b732f295687f0d2f2f37361494c3136c70481d;p=lhc%2Fweb%2Fwiklou.git parserTests: Use a mock parser during article insertion This makes debugging simpler by avoiding log noise, hitting breakpoints unexpectedly, etc. This means that {{subst:}} is no longer supported in !!article sections, but I could only find one test which relied on that. Change-Id: I6400defa389389e5d9632fb01d4a534c0d88d442 --- diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php index a19fea1bd0..d79fbd77a1 100644 --- a/tests/common/TestsAutoLoader.php +++ b/tests/common/TestsAutoLoader.php @@ -35,6 +35,7 @@ $wgAutoloadClasses += [ 'DjVuSupport' => "$testDir/parser/DjVuSupport.php", 'TestRecorder' => "$testDir/parser/TestRecorder.php", 'MultiTestRecorder' => "$testDir/parser/MultiTestRecorder.php", + 'ParserTestMockParser' => "$testDir/parser/ParserTestMockParser.php", 'ParserTestRunner' => "$testDir/parser/ParserTestRunner.php", 'ParserTestParserHook' => "$testDir/parser/ParserTestParserHook.php", 'ParserTestPrinter' => "$testDir/parser/ParserTestPrinter.php", diff --git a/tests/parser/ParserTestMockParser.php b/tests/parser/ParserTestMockParser.php new file mode 100644 index 0000000000..0757b34cfb --- /dev/null +++ b/tests/parser/ParserTestMockParser.php @@ -0,0 +1,20 @@ +getParser(); + $restore = $this->executeSetupSnippets( [ 'wgParser' => new ParserTestMockParser ] ); $status = $page->doEditContent( ContentHandler::makeContent( $text, $title ), '', EDIT_NEW ); + $restore(); + if ( !$status->isOK() ) { throw new MWException( $status->getWikiText( false, false, 'en' ) ); }