From 44e68ac4f708a9f393a9d2e228acbd35c1cf2f07 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 6 Nov 2012 12:11:24 +0100 Subject: [PATCH] RecentChangeTest now uses 'colon-separator' msg LogFormatter uses "colon-separator" message instead of an hardcoded string. Since the RecentChangeTest use hardcoded colon, tests would break whenever the message in the site language is not exactly the same as the english version. Change-Id: I6360584caff53fda0b2688964ae614bc9fdcc97e --- tests/phpunit/includes/RecentChangeTest.php | 30 +++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/phpunit/includes/RecentChangeTest.php b/tests/phpunit/includes/RecentChangeTest.php index a1f808c68b..5b99628e4d 100644 --- a/tests/phpunit/includes/RecentChangeTest.php +++ b/tests/phpunit/includes/RecentChangeTest.php @@ -57,16 +57,18 @@ class RecentChangeTest extends MediaWikiTestCase { * @covers LogFormatter::getIRCActionText */ function testIrcMsgForLogTypeBlock() { + $sep = $this->context->msg( 'colon-separator' )->text(); + # block/block $this->assertIRCComment( - $this->context->msg( 'blocklogentry', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'blocklogentry', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'block', 'block', array(), $this->user_comment ); # block/unblock $this->assertIRCComment( - $this->context->msg( 'unblocklogentry', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'unblocklogentry', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'block', 'unblock', array(), $this->user_comment @@ -77,9 +79,11 @@ class RecentChangeTest extends MediaWikiTestCase { * @covers LogFormatter::getIRCActionText */ function testIrcMsgForLogTypeDelete() { + $sep = $this->context->msg( 'colon-separator' )->text(); + # delete/delete $this->assertIRCComment( - $this->context->msg( 'deletedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'deletedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'delete', 'delete', array(), $this->user_comment @@ -87,7 +91,7 @@ class RecentChangeTest extends MediaWikiTestCase { # delete/restore $this->assertIRCComment( - $this->context->msg( 'undeletedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'undeletedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'delete', 'restore', array(), $this->user_comment @@ -128,10 +132,11 @@ class RecentChangeTest extends MediaWikiTestCase { '4::target' => $this->target->getPrefixedText(), '5::noredir' => 0, ); + $sep = $this->context->msg( 'colon-separator' )->text(); # move/move $this->assertIRCComment( - $this->context->msg( '1movedto2', 'SomeTitle', 'TestTarget' )->plain() . ': ' . $this->user_comment, + $this->context->msg( '1movedto2', 'SomeTitle', 'TestTarget' )->plain() . $sep . $this->user_comment, 'move', 'move', $move_params, $this->user_comment @@ -139,7 +144,7 @@ class RecentChangeTest extends MediaWikiTestCase { # move/move_redir $this->assertIRCComment( - $this->context->msg( '1movedto2_redir', 'SomeTitle', 'TestTarget' )->plain() . ': ' . $this->user_comment, + $this->context->msg( '1movedto2_redir', 'SomeTitle', 'TestTarget' )->plain() . $sep . $this->user_comment, 'move', 'move_redir', $move_params, $this->user_comment @@ -169,10 +174,11 @@ class RecentChangeTest extends MediaWikiTestCase { $protectParams = array( '[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)' ); + $sep = $this->context->msg( 'colon-separator' )->text(); # protect/protect $this->assertIRCComment( - $this->context->msg( 'protectedarticle', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'protectedarticle', 'SomeTitle ' . $protectParams[0] )->plain() . $sep . $this->user_comment, 'protect', 'protect', $protectParams, $this->user_comment @@ -180,7 +186,7 @@ class RecentChangeTest extends MediaWikiTestCase { # protect/unprotect $this->assertIRCComment( - $this->context->msg( 'unprotectedarticle', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'unprotectedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'protect', 'unprotect', array(), $this->user_comment @@ -188,7 +194,7 @@ class RecentChangeTest extends MediaWikiTestCase { # protect/modify $this->assertIRCComment( - $this->context->msg( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams[0] )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams[0] )->plain() . $sep . $this->user_comment, 'protect', 'modify', $protectParams, $this->user_comment @@ -199,9 +205,11 @@ class RecentChangeTest extends MediaWikiTestCase { * @covers LogFormatter::getIRCActionText */ function testIrcMsgForLogTypeUpload() { + $sep = $this->context->msg( 'colon-separator' )->text(); + # upload/upload $this->assertIRCComment( - $this->context->msg( 'uploadedimage', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'uploadedimage', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'upload', 'upload', array(), $this->user_comment @@ -209,7 +217,7 @@ class RecentChangeTest extends MediaWikiTestCase { # upload/overwrite $this->assertIRCComment( - $this->context->msg( 'overwroteimage', 'SomeTitle' )->plain() . ': ' . $this->user_comment, + $this->context->msg( 'overwroteimage', 'SomeTitle' )->plain() . $sep . $this->user_comment, 'upload', 'overwrite', array(), $this->user_comment -- 2.20.1