Merge "Get better error message for duplicate names in MagicWordArray"
[lhc/web/wiklou.git] / tests / phpunit / includes / RevisionStorageTest.php
index 3866190..3ba82a6 100644 (file)
@@ -145,7 +145,7 @@ class RevisionStorageTest extends MediaWikiTestCase {
        public function testConstructFromRow() {
                $orig = $this->makeRevision();
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $res = $dbr->select( 'revision', '*', [ 'rev_id' => $orig->getId() ] );
                $this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -163,7 +163,7 @@ class RevisionStorageTest extends MediaWikiTestCase {
        public function testNewFromRow() {
                $orig = $this->makeRevision();
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $res = $dbr->select( 'revision', '*', [ 'rev_id' => $orig->getId() ] );
                $this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -187,7 +187,7 @@ class RevisionStorageTest extends MediaWikiTestCase {
                $orig = $page->getRevision();
                $page->doDeleteArticle( 'test Revision::newFromArchiveRow' );
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $res = $dbr->select( 'archive', '*', [ 'ar_rev_id' => $orig->getId() ] );
                $this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -274,18 +274,6 @@ class RevisionStorageTest extends MediaWikiTestCase {
                $this->assertEquals( $page->getId(), $rev->getPage() );
        }
 
-       /**
-        * @covers Revision::getText
-        */
-       public function testGetText() {
-               $this->hideDeprecated( 'Revision::getText' );
-
-               $orig = $this->makeRevision( [ 'text' => 'hello hello.' ] );
-               $rev = Revision::newFromId( $orig->getId() );
-
-               $this->assertEquals( 'hello hello.', $rev->getText() );
-       }
-
        /**
         * @covers Revision::getContent
         */
@@ -317,42 +305,7 @@ class RevisionStorageTest extends MediaWikiTestCase {
        /**
         * @covers Revision::getContentModel
         */
-       public function testGetContentModel_default_model() {
-               global $wgContentHandlerUseDB;
-
-               if ( !$wgContentHandlerUseDB ) {
-                       $this->markTestSkipped( '$wgContentHandlerUseDB is disabled' );
-               }
-
-               $orig = $this->makeRevision( [ 'text' => 'hello hello.', ] );
-
-               // Change namespace default content model, to make sure getContentModel() uses the
-               // page content model, not the namespace default.
-               $ns = $this->getDefaultWikitextNS();
-               $this->mergeMwGlobalArrayValue( 'wgNamespaceContentModels', [ $ns => CONTENT_MODEL_JSON ] );
-
-               $rev = Revision::newFromId( $orig->getId() );
-
-               // we should still get the correct content model from the page table
-               $this->assertEquals( CONTENT_MODEL_WIKITEXT, $rev->getContentModel() );
-
-               // check that we don't null the revision model if it's equal to the default, but not to
-               // the current page model.
-               $second = $this->makeRevision( [
-                       'text' => '{ "say":"hello" }',
-                       'content_model' => CONTENT_MODEL_JAVASCRIPT
-               ] );
-
-               $rev = Revision::newFromId( $second->getId() );
-
-               // we should now get the content model from the revision table
-               $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );
-       }
-
-       /**
-        * @covers Revision::getContentModel
-        */
-       public function testGetContentModel_other_model() {
+       public function testGetContentModel() {
                global $wgContentHandlerUseDB;
 
                if ( !$wgContentHandlerUseDB ) {
@@ -360,7 +313,7 @@ class RevisionStorageTest extends MediaWikiTestCase {
                }
 
                $orig = $this->makeRevision( [ 'text' => 'hello hello.',
-                                                    'content_model' => CONTENT_MODEL_JAVASCRIPT ] );
+                       'content_model' => CONTENT_MODEL_JAVASCRIPT ] );
                $rev = Revision::newFromId( $orig->getId() );
 
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );