From 9da83220b82de6a5035ee5cddc752998c0cce5e9 Mon Sep 17 00:00:00 2001 From: addshore Date: Mon, 21 Sep 2015 14:58:56 +0100 Subject: [PATCH] Add tests for RecentChange::parse(To|From)RCType Change-Id: I60278aaeef475ed3ec1515b1f5f28d6afcc700c5 --- .../includes/changes/RecentChangeTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/phpunit/includes/changes/RecentChangeTest.php b/tests/phpunit/includes/changes/RecentChangeTest.php index beb911f2fb..4d1a936eaf 100644 --- a/tests/phpunit/includes/changes/RecentChangeTest.php +++ b/tests/phpunit/includes/changes/RecentChangeTest.php @@ -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 ) ); + } + } -- 2.20.1