6 class RecentChangeTest
extends MediaWikiTestCase
{
10 protected $user_comment;
13 public function setUp() {
16 $this->title
= Title
::newFromText( 'SomeTitle' );
17 $this->target
= Title
::newFromText( 'TestTarget' );
18 $this->user
= User
::newFromName( 'UserName' );
20 $this->user_comment
= '<User comment about action>';
21 $this->context
= RequestContext
::newExtraneousContext( $this->title
);
25 * The testIrcMsgForAction* tests are supposed to cover the hacky
26 * LogFormatter::getIRCActionText / bug 34508
28 * Third parties bots listen to those messages. They are clever enough
29 * to fetch the i18n messages from the wiki and then analyze the IRC feed
30 * to reverse engineer the $1, $2 messages.
31 * One thing bots can not detect is when MediaWiki change the meaning of
32 * a message like what happened when we deployed 1.19. $1 became the user
33 * performing the action which broke basically all bots around.
35 * Should cover the following log actions (which are most commonly used by bots):
43 * - newusers/autocreate
47 * - protect/modifyprotect
55 * As well as the following Auto Edit Summaries:
63 * @covers RecentChange::parseParams
65 public function testParseParams() {
73 $this->assertParseParams(
75 'a:1:{s:4:"root";a:2:{s:1:"A";i:1;s:1:"B";s:3:"two";}}'
78 $this->assertParseParams(
83 $this->assertParseParams(
88 $this->assertParseParams(
95 * @param array $expectedParseParams
96 * @param string|null $rawRcParams
98 protected function assertParseParams( $expectedParseParams, $rawRcParams ) {
99 $rc = new RecentChange
;
100 $rc->setAttribs( array( 'rc_params' => $rawRcParams ) );
102 $actualParseParams = $rc->parseParams();
104 $this->assertEquals( $expectedParseParams, $actualParseParams );