From af9016fa279e409468aa71c4dcb648c3f1d268bd Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Wed, 16 Nov 2016 16:46:48 +0700 Subject: [PATCH 1/4] [Validator] improve and added more Indonesian translation. --- .../Resources/translations/validators.id.xlf | 58 ++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf index 742f4a163e..c7061470dc 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.id.xlf @@ -36,11 +36,11 @@ This field was not expected. - Bidang ini tidak diharapkan. + Ruas ini tidak diharapkan. This field is missing. - Bidang ini hilang. + Ruas ini hilang. This value is not a valid date. @@ -52,15 +52,15 @@ This value is not a valid email address. - Nilai ini bukan alamat email yang sah. + Nilai ini bukan alamat surel yang sah. The file could not be found. - Berkas tidak ditemukan. + Berkas tidak dapat ditemukan. The file is not readable. - Berkas tidak bisa dibaca. + Berkas tidak dapat dibaca. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. @@ -68,7 +68,7 @@ The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Jenis berkas ({{ type }}) tidak sah. Jenis berkas yang diijinkan adalah {{ types }}. + Jenis berkas ({{ type }}) tidak sah. Jenis berkas yang diizinkan adalah {{ types }}. This value should be {{ limit }} or less. @@ -116,7 +116,7 @@ The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Ukuran berkas terlalu besar. Ukuran maksimum yang diijinkan adalah {{ limit }} {{ suffix }}. + Ukuran berkas terlalu besar. Ukuran maksimum yang diizinkan adalah {{ limit }} {{ suffix }}. The file is too large. @@ -132,7 +132,7 @@ This file is not a valid image. - Berkas ini tidak termasuk gambar. + Berkas ini tidak termasuk citra. This is not a valid IP address. @@ -156,23 +156,23 @@ The size of the image could not be detected. - Ukuran dari gambar tidak bisa dideteksi. + Ukuran dari citra tidak bisa dideteksi. The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - Lebar gambar terlalu besar ({{ width }}px). Ukuran lebar maksimum adalah {{ max_width }}px. + Lebar citra terlalu besar ({{ width }}px). Ukuran lebar maksimum adalah {{ max_width }}px. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - Lebar gambar terlalu kecil ({{ width }}px). Ukuran lebar minimum yang diharapkan adalah {{ min_width }}px. + Lebar citra terlalu kecil ({{ width }}px). Ukuran lebar minimum yang diharapkan adalah {{ min_width }}px. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Tinggi gambar terlalu besar ({{ height }}px). Ukuran tinggi maksimum adalah {{ max_height }}px. + Tinggi citra terlalu besar ({{ height }}px). Ukuran tinggi maksimum adalah {{ max_height }}px. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - Tinggi gambar terlalu kecil ({{ height }}px). Ukuran tinggi minimum yang diharapkan adalah {{ min_height }}px. + Tinggi citra terlalu kecil ({{ height }}px). Ukuran tinggi minimum yang diharapkan adalah {{ min_height }}px. This value should be the user's current password. @@ -278,6 +278,38 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. Nilai ini seharusnya tidak identik dengan {{ compared_value_type }} {{ compared_value }}. + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Rasio citra terlalu besar ({{ ratio }}). Rasio maksimum yang diizinkan adalah {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Rasio citra terlalu kecil ({{ ratio }}). Rasio minimum yang diharapkan adalah {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Citra persegi ({{ width }}x{{ height }}px). Citra persegi tidak diizinkan. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Citra berorientasi lanskap ({{ width }}x{{ height }}px). Citra berorientasi lanskap tidak diizinkan. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Citra berorientasi potret ({{ width }}x{{ height }}px). Citra berorientasi potret tidak diizinkan. + + + An empty file is not allowed. + Berkas kosong tidak diizinkan. + + + The host could not be resolved. + Host tidak dapat diselesaikan. + + + This value does not match the expected {{ charset }} charset. + Nilai ini tidak memenuhi set karakter {{ charset }} yang diharapkan. + From 127af5765ce790c89ac3acb337ed1f20b628d09c Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Wed, 16 Nov 2016 19:01:25 +0100 Subject: [PATCH 2/4] [DoctrineBridge] Fix deprecation message/documentation of implementing UserProviderInterface using the entity provider --- UPGRADE-2.8.md | 5 +++++ UPGRADE-3.0.md | 3 +++ src/Symfony/Bridge/Doctrine/CHANGELOG.md | 6 ++++++ .../Bridge/Doctrine/Security/User/EntityUserProvider.php | 2 +- .../Doctrine/Tests/Security/User/EntityUserProviderTest.php | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md index ae87a131a9..1d299af3e6 100644 --- a/UPGRADE-2.8.md +++ b/UPGRADE-2.8.md @@ -658,3 +658,8 @@ Routing // url generated in @router service $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL); ``` + +DoctrineBridge +-------------- + * Deprecated using the entity provider with a Doctrine repository implementing `UserProviderInterface`. + Make it implement `UserLoaderInterface` instead. diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index f6bd000ad1..d5b4842eb7 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -202,6 +202,9 @@ UPGRADE FROM 2.x to 3.0 closures, but the closure is now resolved in the type instead of in the loader. + * Using the entity provider with a Doctrine repository implementing `UserProviderInterface` is not supported anymore. + You should make the repository implement `UserLoaderInterface` instead. + ### EventDispatcher * The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface` diff --git a/src/Symfony/Bridge/Doctrine/CHANGELOG.md b/src/Symfony/Bridge/Doctrine/CHANGELOG.md index 4d8c44701d..71a2707bab 100644 --- a/src/Symfony/Bridge/Doctrine/CHANGELOG.md +++ b/src/Symfony/Bridge/Doctrine/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +2.8.0 +----- + + * deprecated using the entity provider with a Doctrine repository implementing UserProviderInterface + * added UserLoaderInterface for loading users through Doctrine. + 2.7.0 ----- diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php index 2882fd6ddd..f67b4c9c3c 100644 --- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php @@ -55,7 +55,7 @@ class EntityUserProvider implements UserProviderInterface throw new \InvalidArgumentException(sprintf('You must either make the "%s" entity Doctrine Repository ("%s") implement "Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface" or set the "property" option in the corresponding entity provider configuration.', $this->classOrAlias, get_class($repository))); } - @trigger_error('Implementing loadUserByUsername from Symfony\Component\Security\Core\User\UserProviderInterface is deprecated since version 2.8 and will be removed in 3.0. Implement the Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED); + @trigger_error('Implementing Symfony\Component\Security\Core\User\UserProviderInterface in a Doctrine repository when using the entity provider is deprecated since version 2.8 and will not be supported in 3.0. Make the repository implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED); } $user = $repository->loadUserByUsername($username); diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php index a4c1a77152..56d590b109 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php @@ -81,6 +81,7 @@ class EntityUserProviderTest extends \PHPUnit_Framework_TestCase /** * @group legacy + * @expectedDeprecation Implementing Symfony\Component\Security\Core\User\UserProviderInterface in a Doctrine repository when using the entity provider is deprecated since version 2.8 and will not be supported in 3.0. Make the repository implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead. */ public function testLoadUserByUsernameWithUserProviderRepositoryAndWithoutProperty() { From 8e0da2f39ea26c8c83f00eb9bf6303239e14202f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 16 Nov 2016 19:37:44 -0500 Subject: [PATCH 3/4] [DI] Fix error when trying to resolve a DefinitionDecorator --- .../DependencyInjection/ContainerBuilder.php | 4 ++++ .../Tests/ContainerBuilderTest.php | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 6814d28e73..7c9f5a2431 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -840,6 +840,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface */ public function createService(Definition $definition, $id, $tryProxy = true) { + if ('Symfony\Component\DependencyInjection\Definition' !== get_class($definition)) { + throw new RuntimeException(sprintf('Constructing service "%s" from a %s is not supported at build time.', $id, get_class($definition))); + } + if ($definition->isSynthetic()) { throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index eab8fccbdf..8f8c8b179f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; @@ -404,6 +405,20 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions'); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage Constructing service "foo" from a Symfony\Component\DependencyInjection\DefinitionDecorator is not supported at build time. + */ + public function testResolveServicesWithDecoratedDefinition() + { + $builder = new ContainerBuilder(); + $builder->setDefinition('grandpa', new Definition('stdClass')); + $builder->setDefinition('parent', new DefinitionDecorator('grandpa')); + $builder->setDefinition('foo', new DefinitionDecorator('parent')); + + $builder->get('foo'); + } + public function testMerge() { $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); From e0f9bda49aedcb6f46a20659ba3213626418627f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 17 Nov 2016 10:59:01 -0500 Subject: [PATCH 4/4] [ci] Testing with UTC hides bugs --- .travis.yml | 1 + appveyor.yml | 2 +- ...ntegerToLocalizedStringTransformerTest.php | 4 +-- .../MoneyToLocalizedStringTransformerTest.php | 4 +-- ...NumberToLocalizedStringTransformerTest.php | 34 +++++++++---------- ...ercentToLocalizedStringTransformerTest.php | 4 +-- .../Extension/Core/Type/CountryTypeTest.php | 2 +- .../Extension/Core/Type/CurrencyTypeTest.php | 2 +- .../Extension/Core/Type/DateTypeTest.php | 22 ++++++------ .../Extension/Core/Type/IntegerTypeTest.php | 2 +- .../Extension/Core/Type/LanguageTypeTest.php | 2 +- .../Extension/Core/Type/LocaleTypeTest.php | 2 +- .../Extension/Core/Type/MoneyTypeTest.php | 2 +- .../Extension/Core/Type/NumberTypeTest.php | 2 +- .../Collator/Verification/CollatorTest.php | 2 +- .../AbstractIntlDateFormatterTest.php | 4 +-- .../Verification/IntlDateFormatterTest.php | 4 ++- .../Globals/Verification/IntlGlobalsTest.php | 2 +- .../Tests/Locale/Verification/LocaleTest.php | 2 +- .../Verification/NumberFormatterTest.php | 9 ++++- .../Component/Intl/Util/IntlTestHelper.php | 29 +++++----------- .../Component/Locale/Tests/LocaleTest.php | 2 +- .../Tests/IdentityTranslatorTest.php | 2 +- .../Constraints/CountryValidatorTest.php | 2 +- .../Constraints/CurrencyValidatorTest.php | 2 +- .../Constraints/LanguageValidatorTest.php | 2 +- 26 files changed, 72 insertions(+), 75 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e8436f831..70e364f8f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,7 @@ before_install: # A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line - if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi - if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi + - if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi - if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi - if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi diff --git a/appveyor.yml b/appveyor.yml index adf63a1539..f8162c0689 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,7 +33,7 @@ install: - cd .. - copy /Y php.ini-development php.ini-min - echo max_execution_time=1200 >> php.ini-min - - echo date.timezone="UTC" >> php.ini-min + - echo date.timezone="America/Los_Angeles" >> php.ini-min - echo extension_dir=ext >> php.ini-min - copy /Y php.ini-min php.ini-max - echo extension=php_openssl.dll >> php.ini-max diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php index c51132518b..b38296813c 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php @@ -87,7 +87,7 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas public function testReverseTransform() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -109,7 +109,7 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas public function testReverseTransformWithGrouping() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php index 99e4c8a574..0fa2df0564 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php @@ -19,7 +19,7 @@ class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testTransform() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -47,7 +47,7 @@ class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransform() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index 3bf8d93c8c..90d9719a90 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -42,7 +42,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testTransform($from, $to, $locale) { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault($locale); @@ -68,7 +68,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testTransformWithGrouping($from, $to, $locale) { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault($locale); @@ -80,7 +80,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testTransformWithScale() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -185,7 +185,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testTransformWithRounding($scale, $input, $output, $roundingMode) { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -197,7 +197,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testTransformDoesNotRoundIfNoScale() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -212,7 +212,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransform($to, $from, $locale) { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault($locale); @@ -227,7 +227,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransformWithGrouping($to, $from, $locale) { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault($locale); @@ -244,7 +244,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransformWithGroupingAndFixedSpaces() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('ru'); @@ -256,7 +256,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransformWithGroupingButWithoutGroupSeparator() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -376,7 +376,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('fr'); $transformer = new NumberToLocalizedStringTransformer(null, true); @@ -396,7 +396,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -411,7 +411,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -423,7 +423,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('fr'); $transformer = new NumberToLocalizedStringTransformer(); @@ -435,7 +435,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('bg'); $transformer = new NumberToLocalizedStringTransformer(null, true); @@ -588,7 +588,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('ru'); @@ -605,7 +605,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('ru'); @@ -633,7 +633,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte() { // Since we test against other locales, we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('ru'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php index 99f06741b9..c0447656f3 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php @@ -53,7 +53,7 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas public function testTransformWithScale() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -92,7 +92,7 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas public function testReverseTransformWithScale() { // Since we test against "de_AT", we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php index 16af981e62..a14287c827 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php @@ -19,7 +19,7 @@ class CountryTypeTest extends TestCase { protected function setUp() { - IntlTestHelper::requireIntl($this); + IntlTestHelper::requireIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php index 2d572d60b4..f2b096f026 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php @@ -19,7 +19,7 @@ class CurrencyTypeTest extends TestCase { protected function setUp() { - IntlTestHelper::requireIntl($this); + IntlTestHelper::requireIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 1672af481b..ea302d020e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -70,7 +70,7 @@ class DateTypeTest extends TestCase public function testSubmitFromSingleTextDateTime() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -91,7 +91,7 @@ class DateTypeTest extends TestCase public function testSubmitFromSingleTextString() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -112,7 +112,7 @@ class DateTypeTest extends TestCase public function testSubmitFromSingleTextTimestamp() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -135,7 +135,7 @@ class DateTypeTest extends TestCase public function testSubmitFromSingleTextRaw() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -399,7 +399,7 @@ class DateTypeTest extends TestCase public function testSetDataWithNegativeTimezoneOffsetStringInput() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -421,7 +421,7 @@ class DateTypeTest extends TestCase public function testSetDataWithNegativeTimezoneOffsetDateTimeInput() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -495,7 +495,7 @@ class DateTypeTest extends TestCase public function testMonthsOptionLongFormat() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -515,7 +515,7 @@ class DateTypeTest extends TestCase public function testMonthsOptionLongFormatWithDifferentTimezone() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -621,7 +621,7 @@ class DateTypeTest extends TestCase public function testPassDatePatternToView() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -634,7 +634,7 @@ class DateTypeTest extends TestCase public function testPassDatePatternToViewDifferentFormat() { // we test against "de_AT", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_AT'); @@ -682,7 +682,7 @@ class DateTypeTest extends TestCase public function testDatePatternFormatWithQuotedStrings() { // we test against "es_ES", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('es_ES'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php index 85f91ff181..bad3d0881b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php @@ -18,7 +18,7 @@ class IntegerTypeTest extends TestCase { protected function setUp() { - IntlTestHelper::requireIntl($this); + IntlTestHelper::requireIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php index ea6255d034..fb33168100 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php @@ -19,7 +19,7 @@ class LanguageTypeTest extends TestCase { protected function setUp() { - IntlTestHelper::requireIntl($this); + IntlTestHelper::requireIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php index 7f6d922ec9..f33d705b31 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php @@ -19,7 +19,7 @@ class LocaleTypeTest extends TestCase { protected function setUp() { - IntlTestHelper::requireIntl($this); + IntlTestHelper::requireIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php index c499908d77..e454a4f07d 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php @@ -20,7 +20,7 @@ class MoneyTypeTest extends TestCase { // we test against different locales, so we need the full // implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php index f21a7d1ec4..90ef11efa9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php @@ -21,7 +21,7 @@ class NumberTypeTest extends TestCase parent::setUp(); // we test against "de_DE", so we need the full implementation - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('de_DE'); } diff --git a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php index 5da56cc9af..378463cac8 100644 --- a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php +++ b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php @@ -24,7 +24,7 @@ class CollatorTest extends AbstractCollatorTest { protected function setUp() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index 759b995efc..f2788ba469 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -908,9 +908,7 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase { $dateTime = new \DateTime(); $dateTime->setTimestamp(null === $timestamp ? time() : $timestamp); - if (null !== $timeZone) { - $dateTime->setTimezone(new \DateTimeZone($timeZone)); - } + $dateTime->setTimezone(new \DateTimeZone($timeZone ?: getenv('TZ') ?: 'UTC')); return $dateTime; } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php index dcf38473f2..1754a08438 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php @@ -25,7 +25,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest { protected function setUp() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); parent::setUp(); } @@ -45,6 +45,8 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) { + IntlTestHelper::requireFullIntl($this, '55.1'); + if (!$formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern)) { throw new \InvalidArgumentException(intl_get_error_message()); } diff --git a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php index c46033d880..b5cd1c13c3 100644 --- a/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php +++ b/src/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php @@ -24,7 +24,7 @@ class IntlGlobalsTest extends AbstractIntlGlobalsTest { protected function setUp() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php index 39d4f3cb03..adfec280a7 100644 --- a/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php +++ b/src/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php @@ -24,7 +24,7 @@ class LocaleTest extends AbstractLocaleTest { protected function setUp() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); parent::setUp(); } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php index 28e6fe9090..181b489c15 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php @@ -22,7 +22,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest { protected function setUp() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, '55.1'); parent::setUp(); } @@ -32,6 +32,13 @@ class NumberFormatterTest extends AbstractNumberFormatterTest $this->assertInstanceOf('\NumberFormatter', \NumberFormatter::create('en', \NumberFormatter::DECIMAL)); } + public function testGetTextAttribute() + { + IntlTestHelper::requireFullIntl($this); + + parent::testGetTextAttribute(); + } + protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null) { return new \NumberFormatter($locale, $style, $pattern); diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php index ecd5ed6b66..71fb4acdd7 100644 --- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php +++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php @@ -28,19 +28,21 @@ class IntlTestHelper { /** * Should be called before tests that work fine with the stub implementation. - * - * @param \PhpUnit_Framework_TestCase $testCase */ - public static function requireIntl(\PHPUnit_Framework_TestCase $testCase) + public static function requireIntl(\PHPUnit_Framework_TestCase $testCase, $minimumIcuVersion = null) { + if (null === $minimumIcuVersion) { + $minimumIcuVersion = Intl::getIcuStubVersion(); + } + // We only run tests if the version is *one specific version*. // This condition is satisfied if // // * the intl extension is loaded with version Intl::getIcuStubVersion() // * the intl extension is not loaded - if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', 1)) { - $testCase->markTestSkipped('ICU version '.Intl::getIcuStubVersion().' is required.'); + if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '!=', 1)) { + $testCase->markTestSkipped('ICU version '.$minimumIcuVersion.' is required.'); } // Normalize the default locale in case this is not done explicitly @@ -60,24 +62,15 @@ class IntlTestHelper /** * Should be called before tests that require a feature-complete intl * implementation. - * - * @param \PhpUnit_Framework_TestCase $testCase */ - public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase) + public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase, $minimumIcuVersion = null) { // We only run tests if the intl extension is loaded... if (!Intl::isExtensionLoaded()) { $testCase->markTestSkipped('Extension intl is required.'); } - // ... and only if the version is *one specific version* - if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', 1)) { - $testCase->markTestSkipped('ICU version '.Intl::getIcuStubVersion().' is required.'); - } - - // Normalize the default locale in case this is not done explicitly - // in the test - \Locale::setDefault('en'); + self::requireIntl($testCase, $minimumIcuVersion); // Consequently, tests will // @@ -89,8 +82,6 @@ class IntlTestHelper /** * Skips the test unless the current system has a 32bit architecture. - * - * @param \PhpUnit_Framework_TestCase $testCase */ public static function require32Bit(\PHPUnit_Framework_TestCase $testCase) { @@ -101,8 +92,6 @@ class IntlTestHelper /** * Skips the test unless the current system has a 64bit architecture. - * - * @param \PhpUnit_Framework_TestCase $testCase */ public static function require64Bit(\PHPUnit_Framework_TestCase $testCase) { diff --git a/src/Symfony/Component/Locale/Tests/LocaleTest.php b/src/Symfony/Component/Locale/Tests/LocaleTest.php index 7419d28369..6d160a0833 100644 --- a/src/Symfony/Component/Locale/Tests/LocaleTest.php +++ b/src/Symfony/Component/Locale/Tests/LocaleTest.php @@ -36,7 +36,7 @@ class LocaleTest extends \PHPUnit_Framework_TestCase public function testGetDisplayCountriesForSwitzerland() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); $countries = Locale::getDisplayCountries('de_CH'); $this->assertEquals('Schweiz', $countries['CH']); diff --git a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php index 352dd318dc..648c54afd1 100644 --- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php @@ -60,7 +60,7 @@ class IdentityTranslatorTest extends \PHPUnit_Framework_TestCase public function testGetLocaleReturnsDefaultLocaleIfNotSet() { // in order to test with "pt_BR" - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); $translator = new IdentityTranslator(); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php index ba63fd4d1c..563af70763 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php @@ -96,7 +96,7 @@ class CountryValidatorTest extends AbstractConstraintValidatorTest public function testValidateUsingCountrySpecificLocale() { // in order to test with "en_GB" - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('en_GB'); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php index eeb782c1a5..d24e01c2e7 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php @@ -65,7 +65,7 @@ class CurrencyValidatorTest extends AbstractConstraintValidatorTest **/ public function testValidCurrenciesWithCountrySpecificLocale($currency) { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('en_GB'); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php index c10f26c88f..dd149b24ee 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php @@ -95,7 +95,7 @@ class LanguageValidatorTest extends AbstractConstraintValidatorTest public function testValidateUsingCountrySpecificLocale() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('fr_FR'); $existingLanguage = 'en';