Skip to content

Commit

Permalink
Add LocaleTypeTest::testInvalidLocaleMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Jan 26, 2019
1 parent afb7bb5 commit e882dfb
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -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
{
Expand Down Expand Up @@ -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());
}
}

0 comments on commit e882dfb

Please sign in to comment.