Force CommentMigration MIGRATION_OLD in 2 RevisionTest tests
authoraddshore <addshorewiki@gmail.com>
Thu, 1 Feb 2018 14:37:04 +0000 (14:37 +0000)
committeraddshore <addshorewiki@gmail.com>
Thu, 1 Feb 2018 14:40:57 +0000 (14:40 +0000)
These tests fail when the comment store migration is not
set to old, this probably indicates that we need some more
tests for other cases, or that we don't want to test the comment
store functionality here and should mock comment store.

Change-Id: I06d2171498da6e07997569d4a74a0c5cfc913f33

tests/phpunit/includes/RevisionTest.php

index 73d69a5..e2126fc 100644 (file)
@@ -317,6 +317,8 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray
         */
        public function testConstructFromRowWithBadPageId() {
         * @covers \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray
         */
        public function testConstructFromRowWithBadPageId() {
+               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideMwServices();
                MediaWiki\suppressWarnings();
                $rev = new Revision( (object)[ 'rev_page' => 77777777 ] );
                $this->assertSame( 77777777, $rev->getPage() );
                MediaWiki\suppressWarnings();
                $rev = new Revision( (object)[ 'rev_page' => 77777777 ] );
                $this->assertSame( 77777777, $rev->getPage() );
@@ -608,6 +610,8 @@ class RevisionTest extends MediaWikiTestCase {
         * @covers Revision::loadFromTitle
         */
        public function testLoadFromTitle() {
         * @covers Revision::loadFromTitle
         */
        public function testLoadFromTitle() {
+               $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', MIGRATION_OLD );
+               $this->overrideMwServices();
                $title = $this->getMockTitle();
 
                $conditions = [
                $title = $this->getMockTitle();
 
                $conditions = [