Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Intl\Tests\Locale;
use PHPUnit\Framework\TestCase;
/**
* Test case for Locale implementations.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
abstract class AbstractLocaleTest extends TestCase
{
public function testSetDefault()
{
$this->call('setDefault', 'en_GB');
$this->assertSame('en_GB', $this->call('getDefault'));
}
abstract protected function call($methodName);
}

View File

@@ -0,0 +1,134 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Intl\Tests\Locale;
class LocaleTest extends AbstractLocaleTest
{
public function testAcceptFromHttp()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('acceptFromHttp', 'pt-br,en-us;q=0.7,en;q=0.5');
}
public function testComposeLocale()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$subtags = [
'language' => 'pt',
'script' => 'Latn',
'region' => 'BR',
];
$this->call('composeLocale', $subtags);
}
public function testFilterMatches()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('filterMatches', 'pt-BR', 'pt-BR');
}
public function testGetAllVariants()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getAllVariants', 'pt_BR_Latn');
}
public function testGetDisplayLanguage()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayLanguage', 'pt-Latn-BR', 'en');
}
public function testGetDisplayName()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayName', 'pt-Latn-BR', 'en');
}
public function testGetDisplayRegion()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayRegion', 'pt-Latn-BR', 'en');
}
public function testGetDisplayScript()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayScript', 'pt-Latn-BR', 'en');
}
public function testGetDisplayVariant()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getDisplayVariant', 'pt-Latn-BR', 'en');
}
public function testGetKeywords()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getKeywords', 'pt-BR@currency=BRL');
}
public function testGetPrimaryLanguage()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getPrimaryLanguage', 'pt-Latn-BR');
}
public function testGetRegion()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getRegion', 'pt-Latn-BR');
}
public function testGetScript()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('getScript', 'pt-Latn-BR');
}
public function testLookup()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$langtag = [
'pt-Latn-BR',
'pt-BR',
];
$this->call('lookup', $langtag, 'pt-BR-x-priv1');
}
public function testParseLocale()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('parseLocale', 'pt-Latn-BR');
}
public function testSetDefault()
{
$this->expectException('Symfony\Component\Intl\Exception\MethodNotImplementedException');
$this->call('setDefault', 'pt_BR');
}
public function testSetDefaultAcceptsEn()
{
$this->call('setDefault', 'en');
$this->assertSame('en', $this->call('getDefault'));
}
protected function call($methodName)
{
$args = \array_slice(\func_get_args(), 1);
return \call_user_func_array(['Symfony\Component\Intl\Locale\Locale', $methodName], $args);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Intl\Tests\Locale\Verification;
use Symfony\Component\Intl\Tests\Locale\AbstractLocaleTest;
use Symfony\Component\Intl\Util\IntlTestHelper;
/**
* Verifies that {@link AbstractLocaleTest} matches the behavior of the
* {@link Locale} class with a specific version of ICU.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class LocaleTest extends AbstractLocaleTest
{
protected function setUp()
{
IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
protected function call($methodName)
{
$args = \array_slice(\func_get_args(), 1);
return \call_user_func_array(['Locale', $methodName], $args);
}
}