Add test for RecentChange::newFromRow
authoraddshore <addshorewiki@gmail.com>
Mon, 21 Sep 2015 13:51:44 +0000 (14:51 +0100)
committerAddshore <addshorewiki@gmail.com>
Mon, 21 Sep 2015 14:19:48 +0000 (14:19 +0000)
Change-Id: I1e21d296e15c1b6d18f19ae9cc7038387c8f4e2b

tests/phpunit/includes/changes/RecentChangeTest.php

index 0092ac2..beb911f 100644 (file)
@@ -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