30 $cp = Collator::create(
$lang );
31 $cp->setStrength( Collator::PRIMARY );
32 $baseBin = $cp->getSortKey(
$base );
34 $baseBin = rtrim( $baseBin,
"\0" );
35 $extendedBin = $cp->getSortKey( $extended );
36 $this->assertStringStartsWith( $baseBin, $extendedBin,
"$base is not a prefix of $extended" );
63 $cp = Collator::create(
$lang );
64 $cp->setStrength( Collator::PRIMARY );
65 $baseBin = $cp->getSortKey(
$base );
67 $baseBin = rtrim( $baseBin,
"\0" );
68 $extendedBin = $cp->getSortKey( $extended );
69 $this->assertStringStartsNotWith( $baseBin, $extendedBin,
"$base is a prefix of $extended" );
75 [
'en',
'AC',
'ABC' ],
92 $this->assertEquals( $firstLetter, $col->getFirstLetter( $string ) );
97 [
'uppercase',
'Abc',
'A' ],
98 [
'uppercase',
'abc',
'A' ],
99 [
'identity',
'abc',
'a' ],
100 [
'uca-en',
'abc',
'A' ],
101 [
'uca-en',
' ',
' ' ],
102 [
'uca-en',
'Êveryone',
'E' ],
103 [
'uca-vi',
'Êveryone',
'Ê' ],
105 [
'uca-sv',
'The',
'T' ],
106 [
'uca-sv',
'Å',
'Å' ],
107 [
'uca-hu',
'dzsdo',
'Dzs' ],
108 [
'uca-hu',
'dzdso',
'Dz' ],
109 [
'uca-hu',
'CSD',
'Cs' ],
110 [
'uca-root',
'CSD',
'C' ],
111 [
'uca-fi',
'Ǥ',
'G' ],
112 [
'uca-fi',
'Ŧ',
'T' ],
113 [
'uca-fi',
'Ʒ',
'Z' ],
114 [
'uca-fi',
'Ŋ',
'N' ],
115 [
'uppercase-ba',
'в',
'В' ],
Class CollationTest Collation IcuCollation IdentityCollation UppercaseCollation.
static notPrefixDataProvider()
testIsPrefix( $lang, $base, $extended)
Test to make sure, that if you have "X" and "XY", the binary sortkey also has "X" being a prefix of "...
testGetFirstLetter( $collation, $string, $firstLetter)
Test correct first letter is fetched.
static prefixDataProvider()
testNotIsPrefix( $lang, $base, $extended)
Opposite of testIsPrefix.
static factory( $collationName)
if(!isset( $args[0])) $lang