r113088 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113087‎ | r113088 | r113089 >
Date:21:21, 5 March 2012
Author:ialex
Status:ok
Tags:
Comment:
Make RecentChangeTest work by using the same context for expected and actual results. They were failing on my installation because $wgLang->getCode() != $wgContLang->getCode() when the test was called.
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/RecentChangeTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/RecentChangeTest.php
@@ -4,6 +4,7 @@
55 protected $target;
66 protected $user;
77 protected $user_comment;
 8+ protected $context;
89
910 function __construct() {
1011 parent::__construct();
@@ -13,6 +14,7 @@
1415 $this->user = User::newFromName( 'UserName' );
1516
1617 $this->user_comment = '<User comment about action>';
 18+ $this->context = RequestContext::newExtraneousContext( $this->title );
1719 }
1820
1921 /**
@@ -54,14 +56,14 @@
5557 function testIrcMsgForLogTypeBlock() {
5658 # block/block
5759 $this->assertIRCComment(
58 - wfMessage( 'blocklogentry', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 60+ $this->context->msg( 'blocklogentry', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
5961 'block', 'block',
6062 array(),
6163 $this->user_comment
6264 );
6365 # block/unblock
6466 $this->assertIRCComment(
65 - wfMessage( 'unblocklogentry', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 67+ $this->context->msg( 'unblocklogentry', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
6668 'block', 'unblock',
6769 array(),
6870 $this->user_comment
@@ -74,7 +76,7 @@
7577 function testIrcMsgForLogTypeDelete() {
7678 # delete/delete
7779 $this->assertIRCComment(
78 - wfMessage( 'deletedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 80+ $this->context->msg( 'deletedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
7981 'delete', 'delete',
8082 array(),
8183 $this->user_comment
@@ -82,7 +84,7 @@
8385
8486 # delete/restore
8587 $this->assertIRCComment(
86 - wfMessage( 'undeletedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 88+ $this->context->msg( 'undeletedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
8789 'delete', 'restore',
8890 array(),
8991 $this->user_comment
@@ -126,7 +128,7 @@
127129
128130 # move/move
129131 $this->assertIRCComment(
130 - wfMessage( '1movedto2', 'SomeTitle', 'TestTarget' )->plain() . ': ' . $this->user_comment,
 132+ $this->context->msg( '1movedto2', 'SomeTitle', 'TestTarget' )->plain() . ': ' . $this->user_comment,
131133 'move', 'move',
132134 $move_params,
133135 $this->user_comment
@@ -134,7 +136,7 @@
135137
136138 # move/move_redir
137139 $this->assertIRCComment(
138 - wfMessage( '1movedto2_redir', 'SomeTitle', 'TestTarget' )->plain() . ': ' . $this->user_comment,
 140+ $this->context->msg( '1movedto2_redir', 'SomeTitle', 'TestTarget' )->plain() . ': ' . $this->user_comment,
139141 'move', 'move_redir',
140142 $move_params,
141143 $this->user_comment
@@ -147,7 +149,7 @@
148150 function testIrcMsgForLogTypePatrol() {
149151 # patrol/patrol
150152 $this->assertIRCComment(
151 - wfMessage( 'patrol-log-line', 'revision 777', '[[SomeTitle]]', '' )->plain(),
 153+ $this->context->msg( 'patrol-log-line', 'revision 777', '[[SomeTitle]]', '' )->plain(),
152154 'patrol', 'patrol',
153155 array(
154156 '4::curid' => '777',
@@ -167,7 +169,7 @@
168170
169171 # protect/protect
170172 $this->assertIRCComment(
171 - wfMessage( 'protectedarticle', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
 173+ $this->context->msg( 'protectedarticle', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
172174 'protect', 'protect',
173175 $protectParams,
174176 $this->user_comment
@@ -175,7 +177,7 @@
176178
177179 # protect/unprotect
178180 $this->assertIRCComment(
179 - wfMessage( 'unprotectedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 181+ $this->context->msg( 'unprotectedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
180182 'protect', 'unprotect',
181183 array(),
182184 $this->user_comment
@@ -183,7 +185,7 @@
184186
185187 # protect/modify
186188 $this->assertIRCComment(
187 - wfMessage( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
 189+ $this->context->msg( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
188190 'protect', 'modify',
189191 $protectParams,
190192 $this->user_comment
@@ -196,7 +198,7 @@
197199 function testIrcMsgForLogTypeUpload() {
198200 # upload/upload
199201 $this->assertIRCComment(
200 - wfMessage( 'uploadedimage', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 202+ $this->context->msg( 'uploadedimage', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
201203 'upload', 'upload',
202204 array(),
203205 $this->user_comment
@@ -204,7 +206,7 @@
205207
206208 # upload/overwrite
207209 $this->assertIRCComment(
208 - wfMessage( 'overwroteimage', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
 210+ $this->context->msg( 'overwroteimage', 'SomeTitle' )->plain() . ': ' . $this->user_comment,
209211 'upload', 'overwrite',
210212 array(),
211213 $this->user_comment
@@ -217,19 +219,19 @@
218220 * --
219221
220222 function testIrcMsgForBlankingAES() {
221 - // wfMessage( 'autosumm-blank', .. );
 223+ // $this->context->msg( 'autosumm-blank', .. );
222224 }
223225
224226 function testIrcMsgForReplaceAES() {
225 - // wfMessage( 'autosumm-replace', .. );
 227+ // $this->context->msg( 'autosumm-replace', .. );
226228 }
227229
228230 function testIrcMsgForRollbackAES() {
229 - // wfMessage( 'revertpage', .. );
 231+ // $this->context->msg( 'revertpage', .. );
230232 }
231233
232234 function testIrcMsgForUndoAES() {
233 - // wfMessage( 'undo-summary', .. );
 235+ // $this->context->msg( 'undo-summary', .. );
234236 }
235237
236238 * --
@@ -253,7 +255,7 @@
254256 $logEntry->setParameters( $params );
255257
256258 $formatter = LogFormatter::newFromEntry( $logEntry );
257 - $formatter->setContext( RequestContext::newExtraneousContext( $this->title ) );
 259+ $formatter->setContext( $this->context );
258260
259261 // Apply the same transformation as done in RecentChange::getIRCLine for rc_comment
260262 $ircRcComment = RecentChange::cleanupForIRC( $formatter->getIRCActionComment() );

Status & tagging log