From: Kunal Mehta Date: Wed, 14 Sep 2016 00:22:44 +0000 (-0700) Subject: ParserTests: Make sure WikiPage::doEditContent() succeeds X-Git-Tag: 1.31.0-rc.0~5600 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=f5cb6c64c13e1a676911d6349ca7e9443e0727b5;p=lhc%2Fweb%2Fwiklou.git ParserTests: Make sure WikiPage::doEditContent() succeeds If a parser test tries to create a page with invalid content (rejected by Content::prepareSave() or Content::isValid()), throw an exception instead of silently failing. Change-Id: I89642604216699f27884120b3c297a0b277c47a6 --- diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 6659ff8d1c..4ef778dd08 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -1517,7 +1517,10 @@ class ParserTestRunner { throw new MWException( "duplicate article '$name' at $file:$line\n" ); } - $page->doEditContent( ContentHandler::makeContent( $text, $title ), '', EDIT_NEW ); + $status = $page->doEditContent( ContentHandler::makeContent( $text, $title ), '', EDIT_NEW ); + if ( !$status->isOK() ) { + throw new MWException( $status->getWikiText( false, false, 'en' ) ); + } // The RepoGroup cache is invalidated by the creation of file redirects if ( $title->getNamespace() === NS_IMAGE ) {