phpunit: Remove outdated comment about calling of LinkCache::clear()
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiTestCase.php
index c844e13..9f2e5f9 100644 (file)
@@ -213,6 +213,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         *
         * @param Config|null $bootstrapConfig The bootstrap config to use with the new
         *        MediaWikiServices.
+        * @return MediaWikiServices
         */
        protected static function resetGlobalServices( Config $bootstrapConfig = null ) {
                $oldServices = MediaWikiServices::getInstance();
@@ -967,12 +968,13 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         * @since 1.18
         */
        public function needsDB() {
-               # if the test says it uses database tables, it needs the database
+               // If the test says it uses database tables, it needs the database
                if ( $this->tablesUsed ) {
                        return true;
                }
 
-               # if the test says it belongs to the Database group, it needs the database
+               // If the test class says it belongs to the Database group, it needs the database.
+               // NOTE: This ONLY checks for the group in the class level doc comment.
                $rc = new ReflectionClass( $this );
                if ( preg_match( '/@group +Database/im', $rc->getDocComment() ) ) {
                        return true;
@@ -1006,10 +1008,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                $user = static::getTestSysop()->getUser();
                $comment = __METHOD__ . ': Sample page for unit test.';
 
-               // Avoid memory leak...?
-               // LinkCache::singleton()->clear();
-               // Maybe.  But doing this absolutely breaks $title->isRedirect() when called during unit tests....
-
                $page = WikiPage::factory( $title );
                $page->doEditContent( ContentHandler::makeContent( $text, $title ), $comment, 0, false, $user );
 
@@ -1303,7 +1301,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
        private function resetDB( $db, $tablesUsed ) {
                if ( $db ) {
                        $userTables = [ 'user', 'user_groups', 'user_properties' ];
-                       $pageTables = [ 'page', 'revision', 'revision_comment_temp', 'comment' ];
+                       $pageTables = [ 'page', 'revision', 'ip_changes', 'revision_comment_temp', 'comment' ];
                        $coreDBDataTables = array_merge( $userTables, $pageTables );
 
                        // If any of the user or page tables were marked as used, we should clear all of them.
@@ -1591,7 +1589,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         *
         * @since 1.20
         *
-        * @param array $array
+        * @param array &$array
         */
        protected function objectAssociativeSort( array &$array ) {
                uasort(
@@ -1609,7 +1607,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         *
         * @since 1.20
         *
-        * @param mixed $r The array to remove string keys from.
+        * @param mixed &$r The array to remove string keys from.
         */
        protected static function stripStringKeys( &$r ) {
                if ( !is_array( $r ) ) {
@@ -1832,6 +1830,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
 
        /**
         * Used as a marker to prevent wfResetOutputBuffers from breaking PHPUnit.
+        * @param string $buffer
         * @return string
         */
        public static function wfResetOutputBuffersBarrier( $buffer ) {