- md5
- 757c4a2d92817ba9a7673315bc107655
- sha1
- 806460b7a81c456c71c3ae97c784729ad6cf8ad3
- sha256
- f2eb5dfb3d969e170de347005755351f38af9c96a7f8db7ab42156712cf6a83a
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
<?php
namespace Algo26\IdnaConvert\Test;
use Algo26\IdnaConvert\Exception\InvalidIdnVersionException;
use Algo26\IdnaConvert\ToUnicode;
use PHPUnit\Framework\TestCase;
class ToUnicodeTest extends TestCase
{
/**
* @dataProvider providerUtf8
* @throws InvalidIdnVersionException
*/
public function testDecodeUtf8($encoded, $expectDecoded)
{
$idnaConvert = new ToUnicode();
$encoded = $idnaConvert->convert($encoded);
$this->assertEquals(
$expectDecoded,
$encoded,
sprintf(
'Strings "%s" and "%s" do not match',
$expectDecoded,
$encoded
)
);
}
/**
* @dataProvider providerEmailAddress
*
* @throws InvalidIdnVersionException
*/
public function testDecodeEmailAddress($encoded, $expectDecoded)
{
$idnaConvert = new ToUnicode();
$encoded = $idnaConvert->convertEmailAddress($encoded);
$this->assertEquals(
$expectDecoded,
$encoded,
sprintf(
'Strings "%s" and "%s" do not match',
$expectDecoded,
$encoded
)
);
}
/**
* @dataProvider providerUrl
*
* @throws InvalidIdnVersionException
*/
public function testDecodeUrl($encoded, $expectDecoded)
{
$idnaConvert = new ToUnicode();
$encoded = $idnaConvert->convertUrl($encoded);
$this->assertEquals(
$expectDecoded,
$encoded,
sprintf(
'Strings "%s" and "%s" do not match',
$expectDecoded,
$encoded
)
);
}
/**
* @return array
*/
public function providerUtf8()
{
return [
['xn--mller-kva', 'müller'],
['xn--weienbach-i1a', 'weißenbach'],
['xn----9mcj9fole', 'يوم-جيد'],
['xn----2hckbod3a', 'יום-טוב'],
['xn--idndomainaouexample-owb39ane.example', 'idndomainäaöoüuexample.example'],
['xn--ko-eka.example', 'öko.example'],
['xn--6ca0bl71b4a.example', 'æšŧüø.example'],
['xn--4cabegsede9b0e.example', 'ìåíèäæìúíò.example'],
['xn--d1abegsede9b0e.example', 'мениджмънт.example'],
['3+1', '3+1'],
['www.xn--bckermller-q5a70a.example', 'www.bäckermüller.example'],
['xn--cfa', 'ı'],
['xn--ekiszlk-d1a0dy4d', 'ekşisözlük'],
['xn--rdetforstrrefrdselssikkerhed-znc6bz8b', 'rådetforstørrefærdselssikkerhed'],
['xn--kakavalc-0kb76b.example', 'kaşkavalcı.example'],
['xn--uxan.example', 'πι.example'],
['xn--ksigowo-c5a1nq1a.example', 'księgowość.example'],
['xn--80aebfcdsb1blidpdoq4e1i.example', 'регистрациядоменов.example'],
['xn--eqr31enth05q.xn--55qx5d', '国际域名.公司'],
['xn--1caqmypyo.example', 'áéíóöúü.example'],
['xn--1caqmypyo29d8i.example', 'áéíóöőúüű.example'],
['xn--vk1bq81c.example', '대출.example'],
['xn--t-mfutbzh', 'tシャツ'],
['www.xn--clcul3aaa2lcuc4kf.example', 'www.குண்டுபாப்பா.example'],
['xn--3e0b707e', '한국'],
['xn--xu5bx2sncw5i.example', '파티하임.example'],
['xn--o39aa', '가가'],
['xn----5gc8bsteqom5gm.xn--5dbik1ed.xn--9dbalbu5cfl', 'מילון-ראשׁי.תיבות.וקיצורים'],
['xn--rjajzusknak-r7a3h5b', 'írjajézuskának'],
['xn--q3cq3aix1l2a', 'น้ําหอม'],
['xn--q3ca5bk4b5k', 'สํานวน'],
['xn--chambres-dhtes-bpb.example', 'chambres-dhôtes.example'],
['xn--72cba0e8bxb3cu4kb6d6b.example', 'น้ําใสใจจริง.example'],
['xn--bren-mgen-fsse-5hb70axd.example', 'bären-mögen-füsse.example'],
['xn--da-hia.example', 'daß.example'],
['xn--dmin-moa0i.example', 'dömäin.example'],
['xn--aaa-pla.example', 'äaaa.example'],
['xn--aaa-qla.example', 'aäaa.example'],
['xn--aaa-rla.example', 'aaäa.example'],
['xn--aaa-sla.example', 'aaaä.example'],
['xn--dj-kia8a.vu.example', 'déjà.vu.example'],
['xn--efran-2sa.example', 'efraín.example'],
['xn--and-6ma2c.example', 'ñandú.example'],
['foo.xn--bcdf-9na9b.example', 'foo.âbcdéf.example'],
['xn--4gbrim.xn----ymcbaaajlc6dj7bxne2c.xn--wgbh1c', 'موقع.وزارة-الاتصالات.مصر'],
['xn--fuball-cta.example', 'fußball.example'],
['xn--18-uldcat6ad6bydd', 'היפא18פאטאם'],
['xn--18-dtd1bdi0h3ask', 'فرس18النهر'],
];
}
public function providerEmailAddress()
{
return [
['[email protected]', 'some.user@мениджмънт.example'],
['[email protected]', 'some.user@πι.example'],
['söme.ü[email protected]', 'söme.üser@daß.example'],
['[email protected]', 'some.user@foo.âbcdéf.example'],
];
}
public function providerUrl()
{
return [
[
'https://user:[email protected]/home/international/test.html',
'https://user:password@мениджмънт.example/home/international/test.html'
],
[
'https://üser:päß[email protected]/gnörz/lörz/',
'https://üser:päßword@πι.example/gnörz/lörz/'
],
[
'https://user:[email protected]/',
'https://user:password@daß.example/'
],
[
'https://user:[email protected]',
'https://user:password@foo.âbcdéf.example'
],
[
'http://xn--and-6ma2c.example',
'http://ñandú.example'
],
[
'file:///some/path/xn--somewhere/',
'file:///some/path/xn--somewhere/'
],
];
}
}
The same content is in 7 releases, Joomla 4.0.0-alpha11 to 4.0.0-beta5. See them all, or every version of this file.