From 9705da62e1437db4a90eae1fa1ec9d45ae8c1635 Mon Sep 17 00:00:00 2001 From: addshore Date: Mon, 21 Sep 2015 14:51:44 +0100 Subject: [PATCH] Add test for RecentChange::newFromRow Change-Id: I1e21d296e15c1b6d18f19ae9cc7038387c8f4e2b --- .../includes/changes/RecentChangeTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/phpunit/includes/changes/RecentChangeTest.php b/tests/phpunit/includes/changes/RecentChangeTest.php index 0092ac255b..beb911f2fb 100644 --- a/tests/phpunit/includes/changes/RecentChangeTest.php +++ b/tests/phpunit/includes/changes/RecentChangeTest.php @@ -21,6 +21,26 @@ class RecentChangeTest extends MediaWikiTestCase { $this->context = RequestContext::newExtraneousContext( $this->title ); } + /** + * @covers RecentChange::newFromRow + * @covers RecentChange::loadFromRow + */ + public function testNewFromRow() { + $row = new stdClass(); + $row->rc_foo = 'AAA'; + $row->rc_timestamp = '20150921134808'; + $row->rc_deleted = 'bar'; + + $rc = RecentChange::newFromRow( $row ); + + $expected = array( + 'rc_foo' => 'AAA', + 'rc_timestamp' => '20150921134808', + 'rc_deleted' => 'bar', + ); + $this->assertEquals( $expected, $rc->getAttributes() ); + } + /** * The testIrcMsgForAction* tests are supposed to cover the hacky * LogFormatter::getIRCActionText / bug 34508 -- 2.20.1