RevisionTest: Fix getMockTitle()
[lhc/web/wiklou.git] / tests / phpunit / includes / RevisionTest.php
index 73d69a5..d928fb4 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use MediaWiki\MediaWikiServices;
 use MediaWiki\Storage\BlobStoreFactory;
 use MediaWiki\Storage\MutableRevisionRecord;
 use MediaWiki\Storage\RevisionAccessException;
@@ -53,7 +54,7 @@ class RevisionTest extends MediaWikiTestCase {
                        ->method( 'getArticleID' )
                        ->will( $this->returnValue( 23 ) );
                $mock->expects( $this->any() )
-                       ->method( 'getModel' )
+                       ->method( 'getContentModel' )
                        ->will( $this->returnValue( $model ) );
 
                return $mock;
@@ -85,10 +86,10 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray
         */
        public function testConstructFromArrayWithBadPageId() {
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                $rev = new Revision( [ 'page' => 77777777 ] );
                $this->assertSame( 77777777, $rev->getPage() );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
        }
 
        public function provideConstructFromArray_userSetAsExpected() {
@@ -156,13 +157,6 @@ class RevisionTest extends MediaWikiTestCase {
                        new MWException( "Text already stored in external store (id someid), " .
                                "can't serialize content object" )
                ];
-               yield 'unknown user id and no user name' => [
-                       [
-                               'content' => new JavaScriptContent( 'hello world.' ),
-                               'user' => 9989,
-                       ],
-                       new MWException( 'user_text not given, and unknown user ID 9989' )
-               ];
                yield 'with bad content object (class)' => [
                        [ 'content' => new stdClass() ],
                        new MWException( 'content field must contain a Content object.' )
@@ -317,10 +311,12 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray
         */
        public function testConstructFromRowWithBadPageId() {
-               MediaWiki\suppressWarnings();
+               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideMwServices();
+               Wikimedia\suppressWarnings();
                $rev = new Revision( (object)[ 'rev_page' => 77777777 ] );
                $this->assertSame( 77777777, $rev->getPage() );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
        }
 
        public function provideGetRevisionText() {
@@ -487,7 +483,13 @@ class RevisionTest extends MediaWikiTestCase {
 
                $cache = $this->getWANObjectCache();
 
-               $blobStore = new RevisionStore( $lb, $this->getBlobStore(), $cache );
+               $blobStore = new RevisionStore(
+                       $lb,
+                       $this->getBlobStore(),
+                       $cache,
+                       MediaWikiServices::getInstance()->getCommentStore(),
+                       MediaWikiServices::getInstance()->getActorMigration()
+               );
                return $blobStore;
        }
 
@@ -608,6 +610,9 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::loadFromTitle
         */
        public function testLoadFromTitle() {
+               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->setMwGlobals( 'wgActorTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideMwServices();
                $title = $this->getMockTitle();
 
                $conditions = [
@@ -865,6 +870,8 @@ class RevisionTest extends MediaWikiTestCase {
         */
        public function testUserJoinCond() {
                $this->hideDeprecated( 'Revision::userJoinCond' );
+               $this->setMwGlobals( 'wgActorTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideMwServices();
                $this->assertEquals(
                        [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ],
                        Revision::userJoinCond()
@@ -882,6 +889,42 @@ class RevisionTest extends MediaWikiTestCase {
                );
        }
 
+       private function overrideCommentStoreAndActorMigration() {
+               $mockStore = $this->getMockBuilder( CommentStore::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mockStore->expects( $this->any() )
+                       ->method( 'getFields' )
+                       ->willReturn( [ 'commentstore' => 'fields' ] );
+               $mockStore->expects( $this->any() )
+                       ->method( 'getJoin' )
+                       ->willReturn( [
+                               'tables' => [ 'commentstore' => 'table' ],
+                               'fields' => [ 'commentstore' => 'field' ],
+                               'joins' => [ 'commentstore' => 'join' ],
+                       ] );
+               $this->setService( 'CommentStore', $mockStore );
+
+               $mockStore = $this->getMockBuilder( ActorMigration::class )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $mockStore->expects( $this->any() )
+                       ->method( 'getJoin' )
+                       ->willReturnCallback( function ( $key ) {
+                               $p = strtok( $key, '_' );
+                               return [
+                                       'tables' => [ 'actormigration' => 'table' ],
+                                       'fields' => [
+                                               $p . '_user' => 'actormigration_user',
+                                               $p . '_user_text' => 'actormigration_user_text',
+                                               $p . '_actor' => 'actormigration_actor',
+                                       ],
+                                       'joins' => [ 'actormigration' => 'join' ],
+                               ];
+                       } );
+               $this->setService( 'ActorMigration', $mockStore );
+       }
+
        public function provideSelectFields() {
                yield [
                        true,
@@ -892,14 +935,13 @@ class RevisionTest extends MediaWikiTestCase {
                                'rev_timestamp',
                                'rev_user_text',
                                'rev_user',
+                               'rev_actor' => 'NULL',
                                'rev_minor_edit',
                                'rev_deleted',
                                'rev_len',
                                'rev_parent_id',
                                'rev_sha1',
-                               'rev_comment_text' => 'rev_comment',
-                               'rev_comment_data' => 'NULL',
-                               'rev_comment_cid' => 'NULL',
+                               'commentstore' => 'fields',
                                'rev_content_format',
                                'rev_content_model',
                        ]
@@ -913,14 +955,13 @@ class RevisionTest extends MediaWikiTestCase {
                                'rev_timestamp',
                                'rev_user_text',
                                'rev_user',
+                               'rev_actor' => 'NULL',
                                'rev_minor_edit',
                                'rev_deleted',
                                'rev_len',
                                'rev_parent_id',
                                'rev_sha1',
-                               'rev_comment_text' => 'rev_comment',
-                               'rev_comment_data' => 'NULL',
-                               'rev_comment_cid' => 'NULL',
+                               'commentstore' => 'fields',
                        ]
                ];
        }
@@ -928,12 +969,12 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideSelectFields
         * @covers Revision::selectFields
-        * @todo a true unit test would mock CommentStore
         */
        public function testSelectFields( $contentHandlerUseDB, $expected ) {
                $this->hideDeprecated( 'Revision::selectFields' );
                $this->setMwGlobals( 'wgContentHandlerUseDB', $contentHandlerUseDB );
-               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->setMwGlobals( 'wgActorTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideCommentStoreAndActorMigration();
                $this->assertEquals( $expected, Revision::selectFields() );
        }
 
@@ -949,14 +990,13 @@ class RevisionTest extends MediaWikiTestCase {
                                'ar_timestamp',
                                'ar_user_text',
                                'ar_user',
+                               'ar_actor' => 'NULL',
                                'ar_minor_edit',
                                'ar_deleted',
                                'ar_len',
                                'ar_parent_id',
                                'ar_sha1',
-                               'ar_comment_text' => 'ar_comment',
-                               'ar_comment_data' => 'NULL',
-                               'ar_comment_cid' => 'NULL',
+                               'commentstore' => 'fields',
                                'ar_content_format',
                                'ar_content_model',
                        ]
@@ -972,14 +1012,13 @@ class RevisionTest extends MediaWikiTestCase {
                                'ar_timestamp',
                                'ar_user_text',
                                'ar_user',
+                               'ar_actor' => 'NULL',
                                'ar_minor_edit',
                                'ar_deleted',
                                'ar_len',
                                'ar_parent_id',
                                'ar_sha1',
-                               'ar_comment_text' => 'ar_comment',
-                               'ar_comment_data' => 'NULL',
-                               'ar_comment_cid' => 'NULL',
+                               'commentstore' => 'fields',
                        ]
                ];
        }
@@ -987,12 +1026,12 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideSelectArchiveFields
         * @covers Revision::selectArchiveFields
-        * @todo a true unit test would mock CommentStore
         */
        public function testSelectArchiveFields( $contentHandlerUseDB, $expected ) {
                $this->hideDeprecated( 'Revision::selectArchiveFields' );
                $this->setMwGlobals( 'wgContentHandlerUseDB', $contentHandlerUseDB );
-               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->setMwGlobals( 'wgActorTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideCommentStoreAndActorMigration();
                $this->assertEquals( $expected, Revision::selectArchiveFields() );
        }
 
@@ -1042,115 +1081,15 @@ class RevisionTest extends MediaWikiTestCase {
        }
 
        public function provideGetArchiveQueryInfo() {
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage OLD' => [
+               yield 'wgContentHandlerUseDB false' => [
                        [
                                'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
-                       ],
-                       [
-                               'tables' => [ 'archive' ],
-                               'fields' => [
-                                       'ar_id',
-                                       'ar_page_id',
-                                       'ar_namespace',
-                                       'ar_title',
-                                       'ar_rev_id',
-                                       'ar_text',
-                                       'ar_text_id',
-                                       'ar_timestamp',
-                                       'ar_user_text',
-                                       'ar_user',
-                                       'ar_minor_edit',
-                                       'ar_deleted',
-                                       'ar_len',
-                                       'ar_parent_id',
-                                       'ar_sha1',
-                                       'ar_comment_text' => 'ar_comment',
-                                       'ar_comment_data' => 'NULL',
-                                       'ar_comment_cid' => 'NULL',
-                               ],
-                               'joins' => [],
-                       ]
-               ];
-               yield 'wgContentHandlerUseDB true, wgCommentTableSchemaMigrationStage OLD' => [
-                       [
-                               'wgContentHandlerUseDB' => true,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
-                       ],
-                       [
-                               'tables' => [ 'archive' ],
-                               'fields' => [
-                                       'ar_id',
-                                       'ar_page_id',
-                                       'ar_namespace',
-                                       'ar_title',
-                                       'ar_rev_id',
-                                       'ar_text',
-                                       'ar_text_id',
-                                       'ar_timestamp',
-                                       'ar_user_text',
-                                       'ar_user',
-                                       'ar_minor_edit',
-                                       'ar_deleted',
-                                       'ar_len',
-                                       'ar_parent_id',
-                                       'ar_sha1',
-                                       'ar_comment_text' => 'ar_comment',
-                                       'ar_comment_data' => 'NULL',
-                                       'ar_comment_cid' => 'NULL',
-                                       'ar_content_format',
-                                       'ar_content_model',
-                               ],
-                               'joins' => [],
-                       ]
-               ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage WRITE_BOTH' => [
-                       [
-                               'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_BOTH,
-                       ],
-                       [
-                               'tables' => [
-                                       'archive',
-                                       'comment_ar_comment' => 'comment',
-                               ],
-                               'fields' => [
-                                       'ar_id',
-                                       'ar_page_id',
-                                       'ar_namespace',
-                                       'ar_title',
-                                       'ar_rev_id',
-                                       'ar_text',
-                                       'ar_text_id',
-                                       'ar_timestamp',
-                                       'ar_user_text',
-                                       'ar_user',
-                                       'ar_minor_edit',
-                                       'ar_deleted',
-                                       'ar_len',
-                                       'ar_parent_id',
-                                       'ar_sha1',
-                                       'ar_comment_text' => 'COALESCE( comment_ar_comment.comment_text, ar_comment )',
-                                       'ar_comment_data' => 'comment_ar_comment.comment_data',
-                                       'ar_comment_cid' => 'comment_ar_comment.comment_id',
-                               ],
-                               'joins' => [
-                                       'comment_ar_comment' => [
-                                               'LEFT JOIN',
-                                               'comment_ar_comment.comment_id = ar_comment_id',
-                                       ],
-                               ],
-                       ]
-               ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage WRITE_NEW' => [
-                       [
-                               'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_NEW,
                        ],
                        [
                                'tables' => [
                                        'archive',
-                                       'comment_ar_comment' => 'comment',
+                                       'commentstore' => 'table',
+                                       'actormigration' => 'table',
                                ],
                                'fields' => [
                                        'ar_id',
@@ -1161,34 +1100,28 @@ class RevisionTest extends MediaWikiTestCase {
                                        'ar_text',
                                        'ar_text_id',
                                        'ar_timestamp',
-                                       'ar_user_text',
-                                       'ar_user',
                                        'ar_minor_edit',
                                        'ar_deleted',
                                        'ar_len',
                                        'ar_parent_id',
                                        'ar_sha1',
-                                       'ar_comment_text' => 'COALESCE( comment_ar_comment.comment_text, ar_comment )',
-                                       'ar_comment_data' => 'comment_ar_comment.comment_data',
-                                       'ar_comment_cid' => 'comment_ar_comment.comment_id',
-                               ],
-                               'joins' => [
-                                       'comment_ar_comment' => [
-                                               'LEFT JOIN',
-                                               'comment_ar_comment.comment_id = ar_comment_id',
-                                       ],
+                                       'commentstore' => 'field',
+                                       'ar_user' => 'actormigration_user',
+                                       'ar_user_text' => 'actormigration_user_text',
+                                       'ar_actor' => 'actormigration_actor',
                                ],
+                               'joins' => [ 'commentstore' => 'join', 'actormigration' => 'join' ],
                        ]
                ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage NEW' => [
+               yield 'wgContentHandlerUseDB true' => [
                        [
-                               'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_NEW,
+                               'wgContentHandlerUseDB' => true,
                        ],
                        [
                                'tables' => [
                                        'archive',
-                                       'comment_ar_comment' => 'comment',
+                                       'commentstore' => 'table',
+                                       'actormigration' => 'table',
                                ],
                                'fields' => [
                                        'ar_id',
@@ -1199,23 +1132,19 @@ class RevisionTest extends MediaWikiTestCase {
                                        'ar_text',
                                        'ar_text_id',
                                        'ar_timestamp',
-                                       'ar_user_text',
-                                       'ar_user',
                                        'ar_minor_edit',
                                        'ar_deleted',
                                        'ar_len',
                                        'ar_parent_id',
                                        'ar_sha1',
-                                       'ar_comment_text' => 'comment_ar_comment.comment_text',
-                                       'ar_comment_data' => 'comment_ar_comment.comment_data',
-                                       'ar_comment_cid' => 'comment_ar_comment.comment_id',
-                               ],
-                               'joins' => [
-                                       'comment_ar_comment' => [
-                                               'JOIN',
-                                               'comment_ar_comment.comment_id = ar_comment_id',
-                                       ],
+                                       'commentstore' => 'field',
+                                       'ar_user' => 'actormigration_user',
+                                       'ar_user_text' => 'actormigration_user_text',
+                                       'ar_actor' => 'actormigration_actor',
+                                       'ar_content_format',
+                                       'ar_content_model',
                                ],
+                               'joins' => [ 'commentstore' => 'join', 'actormigration' => 'join' ],
                        ]
                ];
        }
@@ -1226,11 +1155,11 @@ class RevisionTest extends MediaWikiTestCase {
         */
        public function testGetArchiveQueryInfo( $globals, $expected ) {
                $this->setMwGlobals( $globals );
+               $this->overrideCommentStoreAndActorMigration();
 
                $revisionStore = $this->getRevisionStore();
                $revisionStore->setContentHandlerUseDB( $globals['wgContentHandlerUseDB'] );
                $this->setService( 'RevisionStore', $revisionStore );
-
                $this->assertEquals(
                        $expected,
                        Revision::getArchiveQueryInfo()
@@ -1238,56 +1167,52 @@ class RevisionTest extends MediaWikiTestCase {
        }
 
        public function provideGetQueryInfo() {
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage OLD, opts none' => [
+               yield 'wgContentHandlerUseDB false, opts none' => [
                        [
                                'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
                        ],
                        [],
                        [
-                               'tables' => [ 'revision' ],
+                               'tables' => [ 'revision', 'commentstore' => 'table', 'actormigration' => 'table' ],
                                'fields' => [
                                        'rev_id',
                                        'rev_page',
                                        'rev_text_id',
                                        'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
                                        'rev_minor_edit',
                                        'rev_deleted',
                                        'rev_len',
                                        'rev_parent_id',
                                        'rev_sha1',
-                                       'rev_comment_text' => 'rev_comment',
-                                       'rev_comment_data' => 'NULL',
-                                       'rev_comment_cid' => 'NULL',
+                                       'commentstore' => 'field',
+                                       'rev_user' => 'actormigration_user',
+                                       'rev_user_text' => 'actormigration_user_text',
+                                       'rev_actor' => 'actormigration_actor',
                                ],
-                               'joins' => [],
+                               'joins' => [ 'commentstore' => 'join', 'actormigration' => 'join' ],
                        ],
                ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage OLD, opts page' => [
+               yield 'wgContentHandlerUseDB false, opts page' => [
                        [
                                'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
                        ],
                        [ 'page' ],
                        [
-                               'tables' => [ 'revision', 'page' ],
+                               'tables' => [ 'revision', 'commentstore' => 'table', 'actormigration' => 'table', 'page' ],
                                'fields' => [
                                        'rev_id',
                                        'rev_page',
                                        'rev_text_id',
                                        'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
                                        'rev_minor_edit',
                                        'rev_deleted',
                                        'rev_len',
                                        'rev_parent_id',
                                        'rev_sha1',
-                                       'rev_comment_text' => 'rev_comment',
-                                       'rev_comment_data' => 'NULL',
-                                       'rev_comment_cid' => 'NULL',
+                                       'commentstore' => 'field',
+                                       'rev_user' => 'actormigration_user',
+                                       'rev_user_text' => 'actormigration_user_text',
+                                       'rev_actor' => 'actormigration_actor',
                                        'page_namespace',
                                        'page_title',
                                        'page_id',
@@ -1300,68 +1225,68 @@ class RevisionTest extends MediaWikiTestCase {
                                                'INNER JOIN',
                                                [ 'page_id = rev_page' ],
                                        ],
+                                       'commentstore' => 'join',
+                                       'actormigration' => 'join',
                                ],
                        ],
                ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage OLD, opts user' => [
+               yield 'wgContentHandlerUseDB false, opts user' => [
                        [
                                'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
                        ],
                        [ 'user' ],
                        [
-                               'tables' => [ 'revision', 'user' ],
+                               'tables' => [ 'revision', 'commentstore' => 'table', 'actormigration' => 'table', 'user' ],
                                'fields' => [
                                        'rev_id',
                                        'rev_page',
                                        'rev_text_id',
                                        'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
                                        'rev_minor_edit',
                                        'rev_deleted',
                                        'rev_len',
                                        'rev_parent_id',
                                        'rev_sha1',
-                                       'rev_comment_text' => 'rev_comment',
-                                       'rev_comment_data' => 'NULL',
-                                       'rev_comment_cid' => 'NULL',
+                                       'commentstore' => 'field',
+                                       'rev_user' => 'actormigration_user',
+                                       'rev_user_text' => 'actormigration_user_text',
+                                       'rev_actor' => 'actormigration_actor',
                                        'user_name',
                                ],
                                'joins' => [
                                        'user' => [
                                                'LEFT JOIN',
                                                [
-                                                       'rev_user != 0',
-                                                       'user_id = rev_user',
+                                                       'actormigration_user != 0',
+                                                       'user_id = actormigration_user',
                                                ],
                                        ],
+                                       'commentstore' => 'join',
+                                       'actormigration' => 'join',
                                ],
                        ],
                ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage OLD, opts text' => [
+               yield 'wgContentHandlerUseDB false, opts text' => [
                        [
                                'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
                        ],
                        [ 'text' ],
                        [
-                               'tables' => [ 'revision', 'text' ],
+                               'tables' => [ 'revision', 'commentstore' => 'table', 'actormigration' => 'table', 'text' ],
                                'fields' => [
                                        'rev_id',
                                        'rev_page',
                                        'rev_text_id',
                                        'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
                                        'rev_minor_edit',
                                        'rev_deleted',
                                        'rev_len',
                                        'rev_parent_id',
                                        'rev_sha1',
-                                       'rev_comment_text' => 'rev_comment',
-                                       'rev_comment_data' => 'NULL',
-                                       'rev_comment_cid' => 'NULL',
+                                       'commentstore' => 'field',
+                                       'rev_user' => 'actormigration_user',
+                                       'rev_user_text' => 'actormigration_user_text',
+                                       'rev_actor' => 'actormigration_actor',
                                        'old_text',
                                        'old_flags',
                                ],
@@ -1370,32 +1295,34 @@ class RevisionTest extends MediaWikiTestCase {
                                                'INNER JOIN',
                                                [ 'rev_text_id=old_id' ],
                                        ],
+                                       'commentstore' => 'join',
+                                       'actormigration' => 'join',
                                ],
                        ],
                ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage OLD, opts 3' => [
+               yield 'wgContentHandlerUseDB false, opts 3' => [
                        [
                                'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
                        ],
                        [ 'text', 'page', 'user' ],
                        [
-                               'tables' => [ 'revision', 'page', 'user', 'text' ],
+                               'tables' => [
+                                       'revision', 'commentstore' => 'table', 'actormigration' => 'table', 'page', 'user', 'text'
+                               ],
                                'fields' => [
                                        'rev_id',
                                        'rev_page',
                                        'rev_text_id',
                                        'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
                                        'rev_minor_edit',
                                        'rev_deleted',
                                        'rev_len',
                                        'rev_parent_id',
                                        'rev_sha1',
-                                       'rev_comment_text' => 'rev_comment',
-                                       'rev_comment_data' => 'NULL',
-                                       'rev_comment_cid' => 'NULL',
+                                       'commentstore' => 'field',
+                                       'rev_user' => 'actormigration_user',
+                                       'rev_user_text' => 'actormigration_user_text',
+                                       'rev_actor' => 'actormigration_actor',
                                        'page_namespace',
                                        'page_title',
                                        'page_id',
@@ -1414,164 +1341,44 @@ class RevisionTest extends MediaWikiTestCase {
                                        'user' => [
                                                'LEFT JOIN',
                                                [
-                                                       'rev_user != 0',
-                                                       'user_id = rev_user',
+                                                       'actormigration_user != 0',
+                                                       'user_id = actormigration_user',
                                                ],
                                        ],
                                        'text' => [
                                                'INNER JOIN',
                                                [ 'rev_text_id=old_id' ],
                                        ],
+                                       'commentstore' => 'join',
+                                       'actormigration' => 'join',
                                ],
                        ],
                ];
-               yield 'wgContentHandlerUseDB true, wgCommentTableSchemaMigrationStage OLD, opts none' => [
+               yield 'wgContentHandlerUseDB true, opts none' => [
                        [
                                'wgContentHandlerUseDB' => true,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_OLD,
                        ],
                        [],
                        [
-                               'tables' => [ 'revision' ],
+                               'tables' => [ 'revision', 'commentstore' => 'table', 'actormigration' => 'table' ],
                                'fields' => [
                                        'rev_id',
                                        'rev_page',
                                        'rev_text_id',
                                        'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
                                        'rev_minor_edit',
                                        'rev_deleted',
                                        'rev_len',
                                        'rev_parent_id',
                                        'rev_sha1',
-                                       'rev_comment_text' => 'rev_comment',
-                                       'rev_comment_data' => 'NULL',
-                                       'rev_comment_cid' => 'NULL',
+                                       'commentstore' => 'field',
+                                       'rev_user' => 'actormigration_user',
+                                       'rev_user_text' => 'actormigration_user_text',
+                                       'rev_actor' => 'actormigration_actor',
                                        'rev_content_format',
                                        'rev_content_model',
                                ],
-                               'joins' => [],
-                       ],
-               ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage WRITE_BOTH, opts none' => [
-                       [
-                               'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_BOTH,
-                       ],
-                       [],
-                       [
-                               'tables' => [
-                                       'revision',
-                                       'temp_rev_comment' => 'revision_comment_temp',
-                                       'comment_rev_comment' => 'comment',
-                               ],
-                               'fields' => [
-                                       'rev_id',
-                                       'rev_page',
-                                       'rev_text_id',
-                                       'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
-                                       'rev_minor_edit',
-                                       'rev_deleted',
-                                       'rev_len',
-                                       'rev_parent_id',
-                                       'rev_sha1',
-                                       'rev_comment_text' => 'COALESCE( comment_rev_comment.comment_text, rev_comment )',
-                                       'rev_comment_data' => 'comment_rev_comment.comment_data',
-                                       'rev_comment_cid' => 'comment_rev_comment.comment_id',
-                               ],
-                               'joins' => [
-                                       'temp_rev_comment' => [
-                                               'LEFT JOIN',
-                                               'temp_rev_comment.revcomment_rev = rev_id',
-                                       ],
-                                       'comment_rev_comment' => [
-                                               'LEFT JOIN',
-                                               'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id',
-                                       ],
-                               ],
-                       ],
-               ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage WRITE_NEW, opts none' => [
-                       [
-                               'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_WRITE_NEW,
-                       ],
-                       [],
-                       [
-                               'tables' => [
-                                       'revision',
-                                       'temp_rev_comment' => 'revision_comment_temp',
-                                       'comment_rev_comment' => 'comment',
-                               ],
-                               'fields' => [
-                                       'rev_id',
-                                       'rev_page',
-                                       'rev_text_id',
-                                       'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
-                                       'rev_minor_edit',
-                                       'rev_deleted',
-                                       'rev_len',
-                                       'rev_parent_id',
-                                       'rev_sha1',
-                                       'rev_comment_text' => 'COALESCE( comment_rev_comment.comment_text, rev_comment )',
-                                       'rev_comment_data' => 'comment_rev_comment.comment_data',
-                                       'rev_comment_cid' => 'comment_rev_comment.comment_id',
-                               ],
-                               'joins' => [
-                                       'temp_rev_comment' => [
-                                               'LEFT JOIN',
-                                               'temp_rev_comment.revcomment_rev = rev_id',
-                                       ],
-                                       'comment_rev_comment' => [
-                                               'LEFT JOIN',
-                                               'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id',
-                                       ],
-                               ],
-                       ],
-               ];
-               yield 'wgContentHandlerUseDB false, wgCommentTableSchemaMigrationStage NEW, opts none' => [
-                       [
-                               'wgContentHandlerUseDB' => false,
-                               'wgCommentTableSchemaMigrationStage' => MIGRATION_NEW,
-                       ],
-                       [],
-                       [
-                               'tables' => [
-                                       'revision',
-                                       'temp_rev_comment' => 'revision_comment_temp',
-                                       'comment_rev_comment' => 'comment',
-                               ],
-                               'fields' => [
-                                       'rev_id',
-                                       'rev_page',
-                                       'rev_text_id',
-                                       'rev_timestamp',
-                                       'rev_user_text',
-                                       'rev_user',
-                                       'rev_minor_edit',
-                                       'rev_deleted',
-                                       'rev_len',
-                                       'rev_parent_id',
-                                       'rev_sha1',
-                                       'rev_comment_text' => 'comment_rev_comment.comment_text',
-                                       'rev_comment_data' => 'comment_rev_comment.comment_data',
-                                       'rev_comment_cid' => 'comment_rev_comment.comment_id',
-                               ],
-                               'joins' => [
-                                       'temp_rev_comment' => [
-                                               'JOIN',
-                                               'temp_rev_comment.revcomment_rev = rev_id',
-                                       ],
-                                       'comment_rev_comment' => [
-                                               'JOIN',
-                                               'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id',
-                                       ],
-                               ],
+                               'joins' => [ 'commentstore' => 'join', 'actormigration' => 'join' ],
                        ],
                ];
        }
@@ -1582,6 +1389,7 @@ class RevisionTest extends MediaWikiTestCase {
         */
        public function testGetQueryInfo( $globals, $options, $expected ) {
                $this->setMwGlobals( $globals );
+               $this->overrideCommentStoreAndActorMigration();
 
                $revisionStore = $this->getRevisionStore();
                $revisionStore->setContentHandlerUseDB( $globals['wgContentHandlerUseDB'] );