Hashar has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/377232 )
Change subject: tests: ensure parserTestRunner restores $wgParser
......................................................................
tests: ensure parserTestRunner restores $wgParser
ParserTestRunner::addArticle() set a dummy $wgParser to ease test
running. However if doEditContent() fails, it would abort and never
restore $wgParser.
Make sure the restoration is done even on exception.
I caught that one while running parser tests with Scribunto and Cite. My
setup lacked a luastandalone which causes Scribunto to throw an
exception. When the Cite tests are run, the MessageCache parser ended up
using $wgParser = ParserTestMockParser;
Change-Id: I33a0a5c1f40f197405d40b7925cc043342e6757e
---
M tests/parser/ParserTestRunner.php
1 file changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/32/377232/1
diff --git a/tests/parser/ParserTestRunner.php
b/tests/parser/ParserTestRunner.php
index 298a3c1..5fe2177 100644
--- a/tests/parser/ParserTestRunner.php
+++ b/tests/parser/ParserTestRunner.php
@@ -1604,12 +1604,15 @@
// get a reference to the mock object.
MessageCache::singleton()->getParser();
$restore = $this->executeSetupSnippets( [ 'wgParser' => new
ParserTestMockParser ] );
- $status = $page->doEditContent(
- ContentHandler::makeContent( $text, $title ),
- '',
- EDIT_NEW | EDIT_INTERNAL
- );
- $restore();
+ try {
+ $status = $page->doEditContent(
+ ContentHandler::makeContent( $text, $title ),
+ '',
+ EDIT_NEW | EDIT_INTERNAL
+ );
+ } finally {
+ $restore();
+ }
if ( !$status->isOK() ) {
throw new MWException( $status->getWikiText( false,
false, 'en' ) );
--
To view, visit https://gerrit.wikimedia.org/r/377232
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I33a0a5c1f40f197405d40b7925cc043342e6757e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits