aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@cscott.net>2020-04-01 17:24:13 -0400
committerC. Scott Ananian <cananian@wikimedia.org>2020-04-13 21:34:04 +0000
commit83a22b7fcde35954461356d4e3859647f45f9cba (patch)
tree8f7b80d92bdf355379dfd5c679a218202e6f774b /tests/parser
parentf92b914449bc5520312d5f23eaaeb2f0e21b0310 (diff)
downloadmediawikicore-83a22b7fcde35954461356d4e3859647f45f9cba.tar.gz
mediawikicore-83a22b7fcde35954461356d4e3859647f45f9cba.zip
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
Diffstat (limited to 'tests/parser')
-rw-r--r--tests/parser/ParserTestRunner.php36
-rw-r--r--tests/parser/TestFileReader.php10
2 files changed, 5 insertions, 41 deletions
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;
@@ -77,11 +76,6 @@ class ParserTestRunner {
private $dbClone;
/**
- * @var TidyDriverBase
- */
- private $tidyDriver = null;
-
- /**
* @var TestRecorder
*/
private $recorder;
@@ -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