LocaleFieldTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Tests\Component\Form;
  11. require_once __DIR__.'/TestCase.php';
  12. use Symfony\Component\Form\LocaleField;
  13. use Symfony\Component\Form\FormContext;
  14. class LocaleFieldTest extends TestCase
  15. {
  16. public function testLocalesAreSelectable()
  17. {
  18. \Locale::setDefault('de_AT');
  19. $field = $this->factory->create('locale', 'locale');
  20. $choices = $field->getRenderer()->getVar('choices');
  21. $this->assertArrayHasKey('en', $choices);
  22. $this->assertEquals('Englisch', $choices['en']);
  23. $this->assertArrayHasKey('en_GB', $choices);
  24. $this->assertEquals('Englisch (Vereinigtes Königreich)', $choices['en_GB']);
  25. $this->assertArrayHasKey('zh_Hans_MO', $choices);
  26. $this->assertEquals('Chinesisch (vereinfacht, Sonderverwaltungszone Macao)', $choices['zh_Hans_MO']);
  27. }
  28. }