Fix caller name in DatabasePostgresTest
[lhc/web/wiklou.git] / tests / phpunit / includes / CommentStoreTest.php
index a510897..0c5d8e3 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use MediaWiki\MediaWikiServices;
 use Wikimedia\ScopedCallback;
 use Wikimedia\TestingAccessWrapper;
 
@@ -23,8 +24,7 @@ class CommentStoreTest extends MediaWikiLangTestCase {
         * @return CommentStore
         */
        protected function makeStore( $stage ) {
-               global $wgContLang;
-               $store = new CommentStore( $wgContLang, $stage );
+               $store = new CommentStore( MediaWikiServices::getInstance()->getContentLanguage(), $stage );
                return $store;
        }
 
@@ -35,6 +35,7 @@ class CommentStoreTest extends MediaWikiLangTestCase {
         * @return CommentStore
         */
        protected function makeStoreWithKey( $stage, $key ) {
+               $this->hideDeprecated( 'CommentStore::newKey' );
                $store = CommentStore::newKey( $key );
                TestingAccessWrapper::newFromObject( $store )->stage = $stage;
                return $store;
@@ -367,13 +368,14 @@ class CommentStoreTest extends MediaWikiLangTestCase {
                ];
 
                $stages = [
-                       MIGRATION_OLD => [ MIGRATION_OLD, MIGRATION_WRITE_NEW ],
-                       MIGRATION_WRITE_BOTH => [ MIGRATION_OLD, MIGRATION_NEW ],
-                       MIGRATION_WRITE_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_NEW ],
-                       MIGRATION_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_NEW ],
+                       MIGRATION_OLD => [ MIGRATION_OLD, MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW ],
+                       MIGRATION_WRITE_BOTH => [ MIGRATION_OLD, MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW,
+                               MIGRATION_NEW ],
+                       MIGRATION_WRITE_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW, MIGRATION_NEW ],
+                       MIGRATION_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW, MIGRATION_NEW ],
                ];
 
-               foreach ( $stages as $writeStage => $readRange ) {
+               foreach ( $stages as $writeStage => $possibleReadStages ) {
                        if ( $key === 'ipb_reason' ) {
                                $extraFields['ipb_address'] = __CLASS__ . "#$writeStage";
                        }
@@ -406,7 +408,7 @@ class CommentStoreTest extends MediaWikiLangTestCase {
                                $callback( $id );
                        }
 
-                       for ( $readStage = $readRange[0]; $readStage <= $readRange[1]; $readStage++ ) {
+                       foreach ( $possibleReadStages as $readStage ) {
                                $rstore = $this->makeStore( $readStage );
 
                                $fieldRow = $this->db->selectRow(
@@ -460,13 +462,14 @@ class CommentStoreTest extends MediaWikiLangTestCase {
                ];
 
                $stages = [
-                       MIGRATION_OLD => [ MIGRATION_OLD, MIGRATION_WRITE_NEW ],
-                       MIGRATION_WRITE_BOTH => [ MIGRATION_OLD, MIGRATION_NEW ],
-                       MIGRATION_WRITE_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_NEW ],
-                       MIGRATION_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_NEW ],
+                       MIGRATION_OLD => [ MIGRATION_OLD, MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW ],
+                       MIGRATION_WRITE_BOTH => [ MIGRATION_OLD, MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW,
+                               MIGRATION_NEW ],
+                       MIGRATION_WRITE_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW, MIGRATION_NEW ],
+                       MIGRATION_NEW => [ MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW, MIGRATION_NEW ],
                ];
 
-               foreach ( $stages as $writeStage => $readRange ) {
+               foreach ( $stages as $writeStage => $possibleReadStages ) {
                        if ( $key === 'ipb_reason' ) {
                                $extraFields['ipb_address'] = __CLASS__ . "#$writeStage";
                        }
@@ -499,7 +502,7 @@ class CommentStoreTest extends MediaWikiLangTestCase {
                                $callback( $id );
                        }
 
-                       for ( $readStage = $readRange[0]; $readStage <= $readRange[1]; $readStage++ ) {
+                       foreach ( $possibleReadStages as $readStage ) {
                                $rstore = $this->makeStoreWithKey( $readStage, $key );
 
                                $fieldRow = $this->db->selectRow(
@@ -772,6 +775,7 @@ class CommentStoreTest extends MediaWikiLangTestCase {
        }
 
        public function testNewKey() {
+               $this->hideDeprecated( 'CommentStore::newKey' );
                $this->assertInstanceOf( CommentStore::class, CommentStore::newKey( 'dummy' ) );
        }