X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FParserTestRunner.php;h=b6c7b03a6ccc5b9bb38d52426cfd5d18b1f4d21a;hb=d312953b76b38849c0ec1481525947d43603a689;hp=1f3183f3ed4a5bce7bd79d625bdcca39150a06b8;hpb=69d27cc0b6d779af8d870fd0e8ccb5cd41f887ab;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 1f3183f3ed..b6c7b03a6c 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -75,11 +75,6 @@ class ParserTestRunner { */ private $dbClone; - /** - * @var TidySupport - */ - private $tidySupport; - /** * @var TidyDriverBase */ @@ -122,12 +117,6 @@ class ParserTestRunner { */ private $runDisabled; - /** - * Run tests intended only for parsoid - * @var bool - */ - private $runParsoid; - /** * Disable parse on article insertion * @var bool @@ -170,16 +159,9 @@ class ParserTestRunner { $this->fileBackendName = $options['file-backend'] ?? false; $this->runDisabled = !empty( $options['run-disabled'] ); - $this->runParsoid = !empty( $options['run-parsoid'] ); $this->disableSaveParse = !empty( $options['disable-save-parse'] ); - $this->tidySupport = new TidySupport( !empty( $options['use-tidy-config'] ) ); - if ( !$this->tidySupport->isEnabled() ) { - $this->recorder->warning( - "Warning: tidy is not installed, skipping some tests\n" ); - } - if ( isset( $options['upload-dir'] ) ) { $this->uploadDir = $options['upload-dir']; } @@ -300,6 +282,7 @@ class ParserTestRunner { $setup['wgHtml5'] = true; $setup['wgDisableLangConversion'] = false; $setup['wgDisableTitleConversion'] = false; + $setup['wgMediaInTargetLanguage'] = false; // "extra language links" // see https://gerrit.wikimedia.org/r/111390 @@ -703,7 +686,6 @@ class ParserTestRunner { foreach ( $filenames as $filename ) { $testFileInfo = TestFileReader::read( $filename, [ 'runDisabled' => $this->runDisabled, - 'runParsoid' => $this->runParsoid, 'regex' => $this->regex ] ); // Don't start the suite if there are no enabled tests in the file @@ -840,12 +822,7 @@ class ParserTestRunner { $options->setTimestamp( $this->getFakeTimestamp() ); if ( isset( $opts['tidy'] ) ) { - if ( !$this->tidySupport->isEnabled() ) { - $this->recorder->skipped( $test, 'tidy extension is not installed' ); - return false; - } else { - $options->setTidy( true ); - } + $options->setTidy( true ); } if ( isset( $opts['title'] ) ) { @@ -1113,6 +1090,7 @@ class ParserTestRunner { + [ 'ISBN' => true, 'PMID' => true, 'RFC' => true ], // Test with legacy encoding by default until HTML5 is very stable and default 'wgFragmentMode' => [ 'legacy' ], + 'wgMediaInTargetLanguage' => self::getOptionValue( 'wgMediaInTargetLanguage', $opts, false ), ]; $nonIncludable = self::getOptionValue( 'wgNonincludableNamespaces', $opts, false ); @@ -1136,12 +1114,19 @@ class ParserTestRunner { if ( isset( $opts['tidy'] ) ) { // Cache a driver instance if ( $this->tidyDriver === null ) { - $this->tidyDriver = MWTidy::factory( $this->tidySupport->getConfig() ); + $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(); @@ -1230,7 +1215,6 @@ class ParserTestRunner { // The new tables for comments are in use $tables[] = 'comment'; $tables[] = 'revision_comment_temp'; - $tables[] = 'image_comment_temp'; } if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) { @@ -1393,7 +1377,17 @@ class ParserTestRunner { 'bits' => 0, 'media_type' => MEDIATYPE_DRAWING, 'mime' => 'image/svg+xml', - 'metadata' => serialize( [] ), + 'metadata' => serialize( [ + 'version' => SvgHandler::SVG_METADATA_VERSION, + 'width' => 240, + 'height' => 180, + 'originalWidth' => '100%', + 'originalHeight' => '100%', + 'translations' => [ + 'en' => SVGReader::LANG_FULL_MATCH, + 'ru' => SVGReader::LANG_FULL_MATCH, + ], + ] ), 'sha1' => Wikimedia\base_convert( '', 16, 36, 31 ), 'fileExists' => true ], $this->db->timestamp( '20010115123500' ), $user );