Add tests for RecentChange::parse(To|From)RCType
authoraddshore <addshorewiki@gmail.com>
Mon, 21 Sep 2015 13:58:56 +0000 (14:58 +0100)
committerAddshore <addshorewiki@gmail.com>
Mon, 21 Sep 2015 14:19:54 +0000 (14:19 +0000)
Change-Id: I60278aaeef475ed3ec1515b1f5f28d6afcc700c5

tests/phpunit/includes/changes/RecentChangeTest.php

index beb911f..4d1a936 100644 (file)
@@ -146,4 +146,29 @@ class RecentChangeTest extends MediaWikiTestCase {
                $this->assertEquals( $expected, RecentChange::isInRCLifespan( $timestamp, $tolerance ) );
        }
 
+       public function provideRCTypes() {
+               return array(
+                       array( RC_EDIT, 'edit' ),
+                       array( RC_NEW, 'new' ),
+                       array( RC_LOG, 'log' ),
+                       array( RC_EXTERNAL, 'external' ),
+               );
+       }
+
+       /**
+        * @dataProvider provideRCTypes
+        * @covers RecentChange::parseFromRCType
+        */
+       public function testParseFromRCType( $rcType, $type ) {
+               $this->assertEquals( $type, RecentChange::parseFromRCType( $rcType ) );
+       }
+
+       /**
+        * @dataProvider provideRCTypes
+        * @covers RecentChange::parseToRCType
+        */
+       public function testParseToRCType( $rcType, $type ) {
+               $this->assertEquals( $rcType, RecentChange::parseToRCType( $type ) );
+       }
+
 }