From 65b732f295687f0d2f2f37361494c3136c70481d Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 6 Oct 2016 16:41:15 +1100 Subject: [PATCH] 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 --- tests/common/TestsAutoLoader.php | 1 + tests/parser/ParserTestMockParser.php | 20 ++++++++++++++++++++ tests/parser/ParserTestRunner.php | 9 ++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/parser/ParserTestMockParser.php 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' ) ); } -- 2.20.1