10000 Add `LocaleTypeTest::testInvalidLocaleMessage()` · symfony/symfony@e882dfb · GitHub
[go: up one dir, main page]

Skip to content

Commit e882dfb

Browse files
committed
Add LocaleTypeTest::testInvalidLocaleMessage()
1 parent afb7bb5 commit e882dfb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
1515
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
1616
use Symfony\Component\Intl\Util\IntlTestHelper;
17+
use Symfony\Component\Validator\Constraints\Locale;
1718

1819
class LocaleTypeTest extends BaseTypeTest
1920
{
@@ -52,4 +53,15 @@ public function testInvalidChoiceValuesAreDropped()
5253

5354
$this->assertSame([], $type->loadChoicesForValues(['foo']));
5455
}
56+
57+
public function testInvalidLocaleMessage()
58+
{
59+
$form = $this->factory->create(static::TESTED_TYPE);
60+
61+
$form->submit('nonexistent-locale');
62+
63+
$localeConstraint = new Locale();
64+
65+
$this->assertSame($localeConstraint->message, $form->getErrors()->current()->getMessage());
66+
}
5567
}

0 commit comments

Comments
 (0)
0