https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113088
Revision: 113088
Author: ialex
Date: 2012-03-05 21:21:34 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
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: trunk/phase3/tests/phpunit/includes/RecentChangeTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/RecentChangeTest.php 2012-03-05
21:20:53 UTC (rev 113087)
+++ trunk/phase3/tests/phpunit/includes/RecentChangeTest.php 2012-03-05
21:21:34 UTC (rev 113088)
@@ -4,6 +4,7 @@
protected $target;
protected $user;
protected $user_comment;
+ protected $context;
function __construct() {
parent::__construct();
@@ -13,6 +14,7 @@
$this->user = User::newFromName( 'UserName' );
$this->user_comment = '<User comment about action>';
+ $this->context = RequestContext::newExtraneousContext(
$this->title );
}
/**
@@ -54,14 +56,14 @@
function testIrcMsgForLogTypeBlock() {
# block/block
$this->assertIRCComment(
- wfMessage( 'blocklogentry', 'SomeTitle' )->plain() . ':
' . $this->user_comment,
+ $this->context->msg( 'blocklogentry', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'block', 'block',
array(),
$this->user_comment
);
# block/unblock
$this->assertIRCComment(
- wfMessage( 'unblocklogentry', 'SomeTitle' )->plain() .
': ' . $this->user_comment,
+ $this->context->msg( 'unblocklogentry', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'block', 'unblock',
array(),
$this->user_comment
@@ -74,7 +76,7 @@
function testIrcMsgForLogTypeDelete() {
# delete/delete
$this->assertIRCComment(
- wfMessage( 'deletedarticle', 'SomeTitle' )->plain() .
': ' . $this->user_comment,
+ $this->context->msg( 'deletedarticle', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'delete', 'delete',
array(),
$this->user_comment
@@ -82,7 +84,7 @@
# delete/restore
$this->assertIRCComment(
- wfMessage( 'undeletedarticle', 'SomeTitle' )->plain() .
': ' . $this->user_comment,
+ $this->context->msg( 'undeletedarticle', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'delete', 'restore',
array(),
$this->user_comment
@@ -126,7 +128,7 @@
# move/move
$this->assertIRCComment(
- wfMessage( '1movedto2', 'SomeTitle', 'TestTarget'
)->plain() . ': ' . $this->user_comment,
+ $this->context->msg( '1movedto2', 'SomeTitle',
'TestTarget' )->plain() . ': ' . $this->user_comment,
'move', 'move',
$move_params,
$this->user_comment
@@ -134,7 +136,7 @@
# move/move_redir
$this->assertIRCComment(
- wfMessage( '1movedto2_redir', 'SomeTitle', 'TestTarget'
)->plain() . ': ' . $this->user_comment,
+ $this->context->msg( '1movedto2_redir', 'SomeTitle',
'TestTarget' )->plain() . ': ' . $this->user_comment,
'move', 'move_redir',
$move_params,
$this->user_comment
@@ -147,7 +149,7 @@
function testIrcMsgForLogTypePatrol() {
# patrol/patrol
$this->assertIRCComment(
- wfMessage( 'patrol-log-line', 'revision 777',
'[[SomeTitle]]', '' )->plain(),
+ $this->context->msg( 'patrol-log-line', 'revision 777',
'[[SomeTitle]]', '' )->plain(),
'patrol', 'patrol',
array(
'4::curid' => '777',
@@ -167,7 +169,7 @@
# protect/protect
$this->assertIRCComment(
- wfMessage( 'protectedarticle', 'SomeTitle ' .
$protectParams[0] )->plain() . ': ' . $this->user_comment,
+ $this->context->msg( 'protectedarticle', 'SomeTitle ' .
$protectParams[0] )->plain() . ': ' . $this->user_comment,
'protect', 'protect',
$protectParams,
$this->user_comment
@@ -175,7 +177,7 @@
# protect/unprotect
$this->assertIRCComment(
- wfMessage( 'unprotectedarticle', 'SomeTitle' )->plain()
. ': ' . $this->user_comment,
+ $this->context->msg( 'unprotectedarticle', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'protect', 'unprotect',
array(),
$this->user_comment
@@ -183,7 +185,7 @@
# protect/modify
$this->assertIRCComment(
- wfMessage( 'modifiedarticleprotection', 'SomeTitle ' .
$protectParams[0] )->plain() . ': ' . $this->user_comment,
+ $this->context->msg( 'modifiedarticleprotection',
'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment,
'protect', 'modify',
$protectParams,
$this->user_comment
@@ -196,7 +198,7 @@
function testIrcMsgForLogTypeUpload() {
# upload/upload
$this->assertIRCComment(
- wfMessage( 'uploadedimage', 'SomeTitle' )->plain() . ':
' . $this->user_comment,
+ $this->context->msg( 'uploadedimage', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'upload', 'upload',
array(),
$this->user_comment
@@ -204,7 +206,7 @@
# upload/overwrite
$this->assertIRCComment(
- wfMessage( 'overwroteimage', 'SomeTitle' )->plain() .
': ' . $this->user_comment,
+ $this->context->msg( 'overwroteimage', 'SomeTitle'
)->plain() . ': ' . $this->user_comment,
'upload', 'overwrite',
array(),
$this->user_comment
@@ -217,19 +219,19 @@
* --
function testIrcMsgForBlankingAES() {
- // wfMessage( 'autosumm-blank', .. );
+ // $this->context->msg( 'autosumm-blank', .. );
}
function testIrcMsgForReplaceAES() {
- // wfMessage( 'autosumm-replace', .. );
+ // $this->context->msg( 'autosumm-replace', .. );
}
function testIrcMsgForRollbackAES() {
- // wfMessage( 'revertpage', .. );
+ // $this->context->msg( 'revertpage', .. );
}
function testIrcMsgForUndoAES() {
- // wfMessage( 'undo-summary', .. );
+ // $this->context->msg( 'undo-summary', .. );
}
* --
@@ -253,7 +255,7 @@
$logEntry->setParameters( $params );
$formatter = LogFormatter::newFromEntry( $logEntry );
- $formatter->setContext( RequestContext::newExtraneousContext(
$this->title ) );
+ $formatter->setContext( $this->context );
// Apply the same transformation as done in
RecentChange::getIRCLine for rc_comment
$ircRcComment = RecentChange::cleanupForIRC(
$formatter->getIRCActionComment() );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs