From e882dfbef00b9c2dbec189f1fc45ed5295a3ad43 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Wed, 9 Jan 2019 16:24:59 -0300 Subject: [PATCH] Add `LocaleTypeTest::testInvalidLocaleMessage()` --- .../Tests/Extension/Core/Type/LocaleTypeTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 e5b3ec9d2ab1..e637e6b474ef 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php @@ -14,6 +14,7 @@ use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\Extension\Core\Type\LocaleType; use Symfony\Component\Intl\Util\IntlTestHelper; +use Symfony\Component\Validator\Constraints\Locale; class LocaleTypeTest extends BaseTypeTest { @@ -52,4 +53,15 @@ public function testInvalidChoiceValuesAreDropped() $this->assertSame([], $type->loadChoicesForValues(['foo'])); } + + public function testInvalidLocaleMessage() + { + $form = $this->factory->create(static::TESTED_TYPE); + + $form->submit('nonexistent-locale'); + + $localeConstraint = new Locale(); + + $this->assertSame($localeConstraint->message, $form->getErrors()->current()->getMessage()); + } }