From 65054c94c2617a2d337344633b508ed510eb2885 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 26 Aug 2016 09:59:10 +1000 Subject: [PATCH] NewParserTest: tear down globals before returning early teardownGlobals() was called at the end of testParserTest(), but not when returning early or throwing a "skipped" exception. This caused a test failure when VisualEditor tests were run after parser tests, due to $wgThumbLimits having the value set in parser tests. Change-Id: I12d9365813fc51c15f6649084c373f5b7ccfac26 --- tests/phpunit/includes/parser/NewParserTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index e7abd15e8b..ad84c207b2 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -712,6 +712,7 @@ class NewParserTest extends MediaWikiTestCase { if ( $this->regex != '' && !preg_match( '/' . $this->regex . '/', $desc ) ) { $this->assertTrue( true ); // XXX: don't flood output with "test made no assertions" // $this->markTestSkipped( 'Filtered out by the user' ); + $this->teardownGlobals(); return; } @@ -719,6 +720,7 @@ class NewParserTest extends MediaWikiTestCase { // parser tests frequently assume that the main namespace contains wikitext. // @todo When setting up pages, force the content model. Only skip if // $wgtContentModelUseDB is false. + $this->teardownGlobals(); $this->markTestSkipped( "Main namespace does not support wikitext," . "skipping parser test: $desc" ); } @@ -749,8 +751,10 @@ class NewParserTest extends MediaWikiTestCase { global $wgTexvc; if ( !isset( $wgTexvc ) ) { + $this->teardownGlobals(); $this->markTestSkipped( "SKIPPED: \$wgTexvc is not set" ); } elseif ( !is_executable( $wgTexvc ) ) { + $this->teardownGlobals(); $this->markTestSkipped( "SKIPPED: texvc binary does not exist" . " or is not executable.\n" . "Current configuration is:\n\$wgTexvc = '$wgTexvc'" ); @@ -759,12 +763,14 @@ class NewParserTest extends MediaWikiTestCase { if ( isset( $opts['djvu'] ) ) { if ( !$this->djVuSupport->isEnabled() ) { + $this->teardownGlobals(); $this->markTestSkipped( "SKIPPED: djvu binaries do not exist or are not executable.\n" ); } } if ( isset( $opts['tidy'] ) ) { if ( !$this->tidySupport->isEnabled() ) { + $this->teardownGlobals(); $this->markTestSkipped( "SKIPPED: tidy extension is not installed.\n" ); } else { $options->setTidy( true ); -- 2.20.1