From: Antoine Musso Date: Wed, 16 Mar 2011 07:38:15 +0000 (+0000) Subject: Makes LanguageTr uc & lc match parent declaration X-Git-Tag: 1.31.0-rc.0~31377 X-Git-Url: http://git.cyclocoop.org//%27http:/code.google.com/p/ie7-js//%27?a=commitdiff_plain;h=97783870bc9996ca5918831540daad69d8d9fcb9;p=lhc%2Fweb%2Fwiklou.git Makes LanguageTr uc & lc match parent declaration Methods were introduced in r84057 which, unfortunatly was tested with PHP errors disabled :\ Additionally add tests for the full Turkish alphabet based on an article from Wikipedia http://en.wikipedia.org/wiki/Turkish_alphabet --- diff --git a/languages/classes/LanguageTr.php b/languages/classes/LanguageTr.php index 297f6b43c5..916843c074 100644 --- a/languages/classes/LanguageTr.php +++ b/languages/classes/LanguageTr.php @@ -29,15 +29,15 @@ class LanguageTr extends Language { } /** @see bug 28040 */ - function uc( $string ) { + function uc( $string, $first = false ) { $string = preg_replace( '/i/', 'İ', $string ); - return parent::uc( $string ); + return parent::uc( $string, $first ); } /** @see bug 28040 */ - function lc( $string ) { + function lc( $string, $first = false ) { $string = preg_replace( '/I/', 'ı', $string ); - return parent::lc( $string ); + return parent::lc( $string, $first ); } } diff --git a/tests/phpunit/languages/LanguageTrTest.php b/tests/phpunit/languages/LanguageTrTest.php index eb3601d202..23aa5484e3 100644 --- a/tests/phpunit/languages/LanguageTrTest.php +++ b/tests/phpunit/languages/LanguageTrTest.php @@ -18,6 +18,33 @@ class LanguageTrTest extends MediaWikiTestCase { unset( $this->lang ); } +##### Full Turkish alphabet ################################################# + + function testLowerCaseTurkishAlphabetToUppercase() { + $this->assertEquals( 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ', + $this->lang->uc( 'abcçdefgğhıijklmnoöprsştuüvyz' ), + 'Lower case Turkish alphabet to upper case' + ); + } + function testUpperCaseTurkishAlphabetToUppercase() { + $this->assertEquals( 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ', + $this->lang->uc( 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ' ), + 'Upper case Turkish alphabet to upper case' + ); + } + function testUpperCaseTurkishAlphabetToLowercase() { + $this->assertEquals( 'abcçdefgğhıijklmnoöprsştuüvyz', + $this->lang->lc( 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ' ), + 'Upper case Turkish alphabet to lower case' + ); + } + function testLowerCaseTurkishAlphabetToLowercase() { + $this->assertEquals( 'abcçdefgğhıijklmnoöprsştuüvyz', + $this->lang->lc( 'abcçdefgğhıijklmnoöprsştuüvyz' ), + 'Lower case Turkish alphabet to lower case' + ); + } + /** * See @bug 28040 * Credits to #wikipedia-tr users berm, []LuCkY[] and Emperyan