C. Scott Ananian has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312048

Change subject: Parser tests: don't use user's tidy configuration for initial 
setup.
......................................................................

Parser tests: don't use user's tidy configuration for initial setup.

We were previously using the user's inherited tidy configuration when
parsing the comments associated with image and article "uploads" prior
to running parser tests.  This causes inconsistent results when
running with different tidy configurations (or none at all) and
confuses a developer who ought to be using the `--use-tidy-config` flag.

Change-Id: I89db16f715d1280be1d3b3c94373d21adea31ad9
---
M tests/parser/ParserTestRunner.php
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/48/312048/1

diff --git a/tests/parser/ParserTestRunner.php 
b/tests/parser/ParserTestRunner.php
index 4ef778d..2d148d1 100644
--- a/tests/parser/ParserTestRunner.php
+++ b/tests/parser/ParserTestRunner.php
@@ -1189,6 +1189,13 @@
                // Create a user
                $user = User::createNew( 'WikiSysop' );
 
+               // For consistency when running tests with different tidy
+               // configurations, explicitly disable tidy for uploads:
+               // recordUpload2 will eventually call $wikiPage->doEditContent 
in
+               // filerepo/file/LocalFile.php, which parses the comment text
+               // applying the current tidy configuration.
+               MWTidy::setInstance( false );
+
                // Register the uploads in the database
 
                $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) 
);
@@ -1313,6 +1320,8 @@
                        'sha1' => Wikimedia\base_convert( '', 16, 36, 31 ),
                        'fileExists' => true
                ], $this->db->timestamp( '20010115123600' ), $user );
+
+               MWTidy::destroySingleton();
 
                return $this->createTeardownObject( $teardown, $nextTeardown );
        }
@@ -1517,7 +1526,13 @@
                        throw new MWException( "duplicate article '$name' at 
$file:$line\n" );
                }
 
+               // For consistency when running tests with different tidy
+               // configurations, explicitly disable tidy here; otherwise
+               // the inherited local tidy configuration will be used when
+               // parsing the comment text for this revision.
+               MWTidy::setInstance( false );
                $status = $page->doEditContent( ContentHandler::makeContent( 
$text, $title ), '', EDIT_NEW );
+               MWTidy::destroySingleton();
                if ( !$status->isOK() ) {
                        throw new MWException( $status->getWikiText( false, 
false, 'en' ) );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89db16f715d1280be1d3b3c94373d21adea31ad9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to