wiki.techinc.nl/tests/phpunit/languages/LanguageTrTest.php
addshore caec5f920a @covers tags for the rest of test files..
Change-Id: I0fafe80531325a412472ab7c9fc6d81c861b3751
2013-10-24 21:38:08 +01:00

61 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @author Antoine Musso
* @copyright Copyright © 2011, Antoine Musso
* @file
*/
/** Tests for MediaWiki languages/LanguageTr.php */
class LanguageTrTest extends LanguageClassesTestCase {
/**
* See @bug 28040
* Credits to irc://irc.freenode.net/wikipedia-tr users:
* - berm
* - []LuCkY[]
* - Emperyan
* @see http://en.wikipedia.org/wiki/Dotted_and_dotless_I
* @dataProvider provideDottedAndDotlessI
* @covers Language::ucfirst
* @covers Language::lcfirst
*/
public function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
if ( $func == 'ucfirst' ) {
$res = $this->getLang()->ucfirst( $input );
} elseif ( $func == 'lcfirst' ) {
$res = $this->getLang()->lcfirst( $input );
} else {
throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
}
$msg = "Converting $inputCase case '$input' with $func should give '$expected'";
$this->assertEquals( $expected, $res, $msg );
}
public static function provideDottedAndDotlessI() {
return array(
# function, input, input case, expected
# Case changed:
array( 'ucfirst', 'ı', 'lower', 'I' ),
array( 'ucfirst', 'i', 'lower', 'İ' ),
array( 'lcfirst', 'I', 'upper', 'ı' ),
array( 'lcfirst', 'İ', 'upper', 'i' ),
# Already using the correct case
array( 'ucfirst', 'I', 'upper', 'I' ),
array( 'ucfirst', 'İ', 'upper', 'İ' ),
array( 'lcfirst', 'ı', 'lower', 'ı' ),
array( 'lcfirst', 'i', 'lower', 'i' ),
# A real example taken from bug 28040 using
# http://tr.wikipedia.org/wiki/%C4%B0Phone
array( 'lcfirst', 'iPhone', 'lower', 'iPhone' ),
# next case is valid in Turkish but are different words if we
# consider IPhone is English!
array( 'lcfirst', 'IPhone', 'upper', 'ıPhone' ),
);
}
}