Add test for RecentChange::newFromRow
[lhc/web/wiklou.git] / 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