From 83a22b7fcde35954461356d4e3859647f45f9cba Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 1 Apr 2020 17:24:13 -0400 Subject: Remove codepaths which ran parser in 'untidy' mode Disabling tidy has been deprecated since 1.33. This cleans up the code paths which still used untidy output. Bug: T198214 Change-Id: I821ef3b8f59b272d983583d407b2f0794fe1e791 --- tests/parser/ParserTestRunner.php | 36 +----------------------------------- tests/parser/TestFileReader.php | 10 ++++------ 2 files changed, 5 insertions(+), 41 deletions(-) (limited to 'tests/parser') diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 984161ef6108..a334c361f039 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -27,7 +27,6 @@ */ use MediaWiki\MediaWikiServices; -use MediaWiki\Tidy\TidyDriverBase; use Wikimedia\Rdbms\IDatabase; use Wikimedia\ScopedCallback; use Wikimedia\TestingAccessWrapper; @@ -76,11 +75,6 @@ class ParserTestRunner { */ private $dbClone; - /** - * @var TidyDriverBase - */ - private $tidyDriver = null; - /** * @var TestRecorder */ @@ -832,10 +826,6 @@ class ParserTestRunner { $options = ParserOptions::newFromContext( $context ); $options->setTimestamp( $this->getFakeTimestamp() ); - if ( isset( $opts['tidy'] ) ) { - $options->setTidy( true ); - } - $revId = 1337; // see Parser::getRevisionId() $title = isset( $opts['title'] ) ? Title::newFromText( $opts['title'] ) @@ -920,9 +910,7 @@ class ParserTestRunner { 'allowTOC' => !isset( $opts['notoc'] ), 'unwrap' => !isset( $opts['wrap'] ), ] ); - if ( isset( $opts['tidy'] ) ) { - $out = preg_replace( '/\s+$/', '', $out ); - } + $out = preg_replace( '/\s+$/', '', $out ); if ( isset( $opts['showtitle'] ) ) { if ( $output->getTitleText() ) { @@ -1147,28 +1135,6 @@ class ParserTestRunner { /** @since 1.20 */ Hooks::run( 'ParserTestGlobals', [ &$setup ] ); - // Create tidy driver - if ( isset( $opts['tidy'] ) ) { - // Cache a driver instance - if ( $this->tidyDriver === null ) { - $this->tidyDriver = MWTidy::factory(); - } - $tidy = $this->tidyDriver; - } else { - $tidy = false; - } - - # Suppress warnings about running tests without tidy - Wikimedia\suppressWarnings(); - wfDeprecated( 'disabling tidy' ); - wfDeprecated( 'MWTidy::setInstance' ); - Wikimedia\restoreWarnings(); - - MWTidy::setInstance( $tidy ); - $teardown[] = function () { - MWTidy::destroySingleton(); - }; - // Set content language. This invalidates the magic word cache and title services $lang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $langCode ); $lang->resetNamespaces(); diff --git a/tests/parser/TestFileReader.php b/tests/parser/TestFileReader.php index 81a1aba3be9f..fdc1e0316391 100644 --- a/tests/parser/TestFileReader.php +++ b/tests/parser/TestFileReader.php @@ -157,12 +157,6 @@ class TestFileReader { ]; if ( $nonTidySection !== false ) { - // Add non-tidy test - $this->tests[] = [ - 'result' => $data[$nonTidySection], - 'resultSection' => $nonTidySection - ] + $commonInfo; - if ( $tidySection !== false ) { // Add tidy subtest $this->tests[] = [ @@ -172,6 +166,10 @@ class TestFileReader { 'options' => $data['options'] . ' tidy', 'isSubtest' => true, ] + $commonInfo; + } else { + // We can no longer run the non-tidy test, and we don't have + // a tidy alternative. + wfDeprecated( 'skipping non-tidy test', '1.35' ); } } elseif ( $tidySection !== false ) { // No need to override desc when there is no subtest -- cgit v1.2.3