Add test for substitution of params with multiple digits
authorNiklas Laxström <niklas.laxstrom@gmail.com>
Wed, 2 Jan 2013 17:06:23 +0000 (17:06 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 3 Jan 2013 09:45:22 +0000 (09:45 +0000)
Change-Id: I293bcdeecd5ee83cf05887aa06dc86b5589398eb

tests/phpunit/includes/MessageTest.php

index 22450dc..c378bb8 100644 (file)
@@ -49,6 +49,13 @@ class MessageTest extends MediaWikiLangTestCase {
                $this->assertEquals( '(Заглавная страница $1)', wfMessage( 'parentheses' )->rawParams( 'Заглавная страница $1' )->plain() );
        }
 
+       function testDeliciouslyManyParams() {
+               $msg = new RawMessage( '$1$2$3$4$5$6$7$8$9$10$11$12' );
+               // One less than above has placeholders
+               $params = array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' );
+               $this->assertEquals( 'abcdefghijka2', $msg->params( $params )->plain(), 'Params > 9 are replaced correctly' );
+       }
+
        function testInContentLanguage() {
                global $wgLang, $wgForceUIMsgAsContentMsg;
                $wgLang = Language::factory( 'fr' );