jenkins-bot has submitted this change and it was merged.

Change subject: More gracefully handle unavailability of ParserFunctions in 
phpunit
......................................................................


More gracefully handle unavailability of ParserFunctions in phpunit

Change-Id: I375c13e937892062b061940b2b9ac5bdd832ac9d
(cherry picked from commit 91abb657c8284a15a49eb613700f1d64f47e1b78)
---
M tests/phpunit/includes/DiscussionParserTest.php
1 file changed, 18 insertions(+), 1 deletion(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/includes/DiscussionParserTest.php 
b/tests/phpunit/includes/DiscussionParserTest.php
index 84f0230..0b9f3c1 100644
--- a/tests/phpunit/includes/DiscussionParserTest.php
+++ b/tests/phpunit/includes/DiscussionParserTest.php
@@ -244,6 +244,7 @@
                                                'agent' => 'PatHadley',
                                        ),
                                ),
+                               'precondition' => 'isParserFunctionsInstalled',
                        ),
                        array(
                                'new' => 647260329,
@@ -271,7 +272,15 @@
        /**
         * @dataProvider generateEventsForRevisionData
         */
-       public function testGenerateEventsForRevision( $newId, $oldId, 
$username, $lang, $pages, $title, $expected ) {
+       public function testGenerateEventsForRevision( $newId, $oldId, 
$username, $lang, $pages, $title, $expected, $precondition = '' ) {
+               if ( $precondition !== '' ) {
+                       $result = $this->$precondition();
+                       if ( $result !== true ) {
+                               $this->markTestSkipped( $result );
+                               return;
+                       }
+               }
+
                $this->setMwGlobals( array(
                        // this global is used by the code that interprets the 
namespace part of
                        // titles (Title::getTitleParser), so should be the 
fake language ;)
@@ -1064,4 +1073,12 @@
                $this->assertEquals( 2, EchoDiscussionParser::getSectionCount( 
$one . $three ) );
                $this->assertEquals( 3, EchoDiscussionParser::getSectionCount( 
$one . $two . $three ) );
        }
+
+       protected function isParserFunctionsInstalled() {
+               if ( class_exists( 'ExtParserFunctions' ) ) {
+                       return true;
+               } else {
+                       return "ParserFunctions not enabled";
+               }
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/191380
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I375c13e937892062b061940b2b9ac5bdd832ac9d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: wmf/1.25wmf17
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to