LanguageFieldTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. use Symfony\Component\Form\LanguageField;
  12. use Symfony\Component\Form\FormContext;
  13. class LanguageFieldTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testCountriesAreSelectable()
  16. {
  17. \Locale::setDefault('de_AT');
  18. $field = new LanguageField('language');
  19. $choices = $field->getOtherChoices();
  20. $this->assertArrayHasKey('en', $choices);
  21. $this->assertEquals('Englisch', $choices['en']);
  22. $this->assertArrayHasKey('en_GB', $choices);
  23. $this->assertEquals('Britisches Englisch', $choices['en_GB']);
  24. $this->assertArrayHasKey('en_US', $choices);
  25. $this->assertEquals('Amerikanisches Englisch', $choices['en_US']);
  26. $this->assertArrayHasKey('fr', $choices);
  27. $this->assertEquals('Französisch', $choices['fr']);
  28. $this->assertArrayHasKey('my', $choices);
  29. $this->assertEquals('Birmanisch', $choices['my']);
  30. }
  31. public function testMultipleLanguagesIsNotIncluded()
  32. {
  33. $field = new LanguageField('language');
  34. $choices = $field->getOtherChoices();
  35. $this->assertArrayNotHasKey('mul', $choices);
  36. }
  37. }