From f5cb6c64c13e1a676911d6349ca7e9443e0727b5 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 13 Sep 2016 17:22:44 -0700 Subject: [PATCH] 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 --- tests/parser/ParserTestRunner.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 ) { -- 2.20.1