Add test for IRC line for type protect/move_prot
[lhc/web/wiklou.git] / tests / phpunit / includes / changes / RecentChangeTest.php
index 98903f1..0dba183 100644 (file)
@@ -35,6 +35,7 @@ class RecentChangeTest extends MediaWikiTestCase {
         * Should cover the following log actions (which are most commonly used by bots):
         * - block/block
         * - block/unblock
+        * - block/reblock
         * - delete/delete
         * - delete/restore
         * - newusers/create
@@ -45,7 +46,11 @@ class RecentChangeTest extends MediaWikiTestCase {
         * - protect/protect
         * - protect/modifyprotect
         * - protect/unprotect
+        * - protect/move_prot
         * - upload/upload
+        * - merge/merge
+        * - import/upload
+        * - import/interwiki
         *
         * As well as the following Auto Edit Summaries:
         * - blank
@@ -62,9 +67,13 @@ class RecentChangeTest extends MediaWikiTestCase {
 
                # block/block
                $this->assertIRCComment(
-                       $this->context->msg( 'blocklogentry', 'SomeTitle' )->plain() . $sep . $this->user_comment,
+                       $this->context->msg( 'blocklogentry', 'SomeTitle', 'duration', '(flags)' )->plain()
+                               . $sep . $this->user_comment,
                        'block', 'block',
-                       array(),
+                       array(
+                               '5::duration' => 'duration',
+                               '6::flags' => 'flags',
+                       ),
                        $this->user_comment
                );
                # block/unblock
@@ -74,6 +83,17 @@ class RecentChangeTest extends MediaWikiTestCase {
                        array(),
                        $this->user_comment
                );
+               # block/reblock
+               $this->assertIRCComment(
+                       $this->context->msg( 'reblock-logentry', 'SomeTitle', 'duration', '(flags)' )->plain()
+                               . $sep . $this->user_comment,
+                       'block', 'reblock',
+                       array(
+                               '5::duration' => 'duration',
+                               '6::flags' => 'flags',
+                       ),
+                       $this->user_comment
+               );
        }
 
        /**
@@ -204,6 +224,15 @@ class RecentChangeTest extends MediaWikiTestCase {
                        $protectParams,
                        $this->user_comment
                );
+
+               # protect/move_prot
+               $this->assertIRCComment(
+                       $this->context->msg( 'movedarticleprotection', 'SomeTitle', 'OldTitle' )
+                               ->plain() . $sep . $this->user_comment,
+                       'protect', 'move_prot',
+                       array( 'OldTitle' ),
+                       $this->user_comment
+               );
        }
 
        /**
@@ -229,6 +258,48 @@ class RecentChangeTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers LogFormatter::getIRCActionText
+        */
+       public function testIrcMsgForLogTypeMerge() {
+               $sep = $this->context->msg( 'colon-separator' )->text();
+
+               # merge/merge
+               $this->assertIRCComment(
+                       $this->context->msg( 'pagemerge-logentry', 'SomeTitle', 'Dest', 'timestamp' )->plain()
+                               . $sep . $this->user_comment,
+                       'merge', 'merge',
+                       array(
+                               '4::dest' => 'Dest',
+                               '5::mergepoint' => 'timestamp',
+                       ),
+                       $this->user_comment
+               );
+       }
+
+       /**
+        * @covers LogFormatter::getIRCActionText
+        */
+       public function testIrcMsgForLogTypeImport() {
+               $sep = $this->context->msg( 'colon-separator' )->text();
+
+               # import/upload
+               $this->assertIRCComment(
+                       $this->context->msg( 'import-logentry-upload', 'SomeTitle' )->plain() . $sep . $this->user_comment,
+                       'import', 'upload',
+                       array(),
+                       $this->user_comment
+               );
+
+               # import/interwiki
+               $this->assertIRCComment(
+                       $this->context->msg( 'import-logentry-interwiki', 'SomeTitle' )->plain() . $sep . $this->user_comment,
+                       'import', 'interwiki',
+                       array(),
+                       $this->user_comment
+               );
+       }
+
        /**
         * @todo Emulate these edits somehow and extract
         * raw edit summary from RecentChange object