Add basic IP range support to Special:Contributions
[lhc/web/wiklou.git] / tests / parser / ParserTestRunner.php
index feed77f..46c551b 100644 (file)
@@ -182,13 +182,18 @@ class ParserTestRunner {
                        if ( !file_exists( $dir ) ) {
                                continue;
                        }
+                       $counter = 1;
                        $dirIterator = new RecursiveIteratorIterator(
                                new RecursiveDirectoryIterator( $dir )
                        );
                        foreach ( $dirIterator as $fileInfo ) {
                                /** @var SplFileInfo $fileInfo */
                                if ( substr( $fileInfo->getFilename(), -4 ) === '.txt' ) {
-                                       $files[] = $fileInfo->getPathname();
+                                       $name = $info['name'] . $counter;
+                                       while ( isset( $files[$name] ) ) {
+                                               $name = $info['name'] . '_' . $counter++;
+                                       }
+                                       $files[$name] = $fileInfo->getPathname();
                                }
                        }
                }
@@ -341,8 +346,9 @@ class ParserTestRunner {
                MediaWikiServices::getInstance()->disableService( 'MediaHandlerFactory' );
                MediaWikiServices::getInstance()->redefineService(
                        'MediaHandlerFactory',
-                       function () {
-                               return new MockMediaHandlerFactory();
+                       function ( MediaWikiServices $services ) {
+                               $handlers = $services->getMainConfig()->get( 'ParserTestMediaHandlers' );
+                               return new MediaHandlerFactory( $handlers );
                        }
                );
                $teardown[] = function () {
@@ -477,7 +483,7 @@ class ParserTestRunner {
         * @see staticSetup
         *
         * @param array $teardown The snippet array
-        * @param ScopedCallback|null A ScopedCallback to consume
+        * @param ScopedCallback|null $nextTeardown A ScopedCallback to consume
         * @return ScopedCallback
         */
        protected function createTeardownObject( $teardown, $nextTeardown = null ) {
@@ -526,7 +532,7 @@ class ParserTestRunner {
         * Determine whether a particular setup function has been run
         *
         * @param string $funcName
-        * @return boolean
+        * @return bool
         */
        public function isSetupDone( $funcName ) {
                return isset( $this->setupDone[$funcName] ) ? $this->setupDone[$funcName] : false;
@@ -1055,6 +1061,8 @@ class ParserTestRunner {
                        // wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
                        'wgEnableMagicLinks' => self::getOptionValue( 'wgEnableMagicLinks', $opts, [] )
                                + [ 'ISBN' => true, 'PMID' => true, 'RFC' => true ],
+                       // Test with legacy encoding by default until HTML5 is very stable and default
+                       'wgFragmentMode' => [ 'legacy' ],
                ];
 
                if ( $config ) {
@@ -1139,7 +1147,7 @@ class ParserTestRunner {
         */
        private function listTables() {
                $tables = [ 'user', 'user_properties', 'user_former_groups', 'page', 'page_restrictions',
-                       'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks',
+                       'protected_titles', 'revision', 'ip_changes', 'text', 'pagelinks', 'imagelinks',
                        'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks',
                        'site_stats', 'ipblocks', 'image', 'oldimage',
                        'recentchanges', 'watchlist', 'interwiki', 'logging', 'log_search',
@@ -1527,7 +1535,7 @@ class ParserTestRunner {
        /**
         * Add articles to the test DB.
         *
-        * @param $articles Article info array from TestFileReader
+        * @param array $articles Article info array from TestFileReader
         */
        public function addArticles( $articles ) {
                global $wgContLang;