4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Form\Tests\Extension\Core\Type
;
14 use Symfony\Component\Form\Extension\Core\View\ChoiceView
;
15 use Symfony\Component\Intl\Util\IntlTestHelper
;
17 class LanguageTypeTest
extends TypeTestCase
19 protected function setUp()
21 IntlTestHelper
::requireIntl($this);
26 public function testCountriesAreSelectable()
28 $form = $this->factory
->create('language');
29 $view = $form->createView();
30 $choices = $view->vars
['choices'];
32 $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
33 $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices, '', false, false);
34 $this->assertContains(new ChoiceView('en_US', 'en_US', 'U.S. English'), $choices, '', false, false);
35 $this->assertContains(new ChoiceView('fr', 'fr', 'French'), $choices, '', false, false);
36 $this->assertContains(new ChoiceView('my', 'my', 'Burmese'), $choices, '', false, false);
39 public function testMultipleLanguagesIsNotIncluded()
41 $form = $this->factory
->create('language', 'language');
42 $view = $form->createView();
43 $choices = $view->vars
['choices'];
45 $this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false);