setDefaultLocale() public static method

Sets the default locale for newly created forms.
public static setDefaultLocale ( string $defaultLocale )
$defaultLocale string
Esempio n. 1
0
 public function testLocalesAreSelectable()
 {
     FormConfiguration::setDefaultLocale('de_AT');
     $field = new LocaleField('language');
     $choices = $field->getOtherChoices();
     $this->assertArrayHasKey('en', $choices);
     $this->assertEquals('Englisch', $choices['en']);
     $this->assertArrayHasKey('en_GB', $choices);
     $this->assertEquals('Englisch (Vereinigtes Königreich)', $choices['en_GB']);
     $this->assertArrayHasKey('zh_Hans_MO', $choices);
     $this->assertEquals('Chinesisch (vereinfacht, Sonderverwaltungszone Macao)', $choices['zh_Hans_MO']);
 }
Esempio n. 2
0
 public function testCountriesAreSelectable()
 {
     FormConfiguration::setDefaultLocale('de_AT');
     $field = new CountryField('country');
     $choices = $field->getOtherChoices();
     $this->assertArrayHasKey('DE', $choices);
     $this->assertEquals('Deutschland', $choices['DE']);
     $this->assertArrayHasKey('GB', $choices);
     $this->assertEquals('Vereinigtes Königreich', $choices['GB']);
     $this->assertArrayHasKey('US', $choices);
     $this->assertEquals('Vereinigte Staaten', $choices['US']);
     $this->assertArrayHasKey('FR', $choices);
     $this->assertEquals('Frankreich', $choices['FR']);
     $this->assertArrayHasKey('MY', $choices);
     $this->assertEquals('Malaysia', $choices['MY']);
 }
Esempio n. 3
0
 public function testCountriesAreSelectable()
 {
     FormConfiguration::setDefaultLocale('de_AT');
     $field = new LanguageField('language');
     $choices = $field->getOtherChoices();
     $this->assertArrayHasKey('en', $choices);
     $this->assertEquals('Englisch', $choices['en']);
     $this->assertArrayHasKey('en_GB', $choices);
     $this->assertEquals('Britisches Englisch', $choices['en_GB']);
     $this->assertArrayHasKey('en_US', $choices);
     $this->assertEquals('Amerikanisches Englisch', $choices['en_US']);
     $this->assertArrayHasKey('fr', $choices);
     $this->assertEquals('Französisch', $choices['fr']);
     $this->assertArrayHasKey('my', $choices);
     $this->assertEquals('Birmanisch', $choices['my']);
 }
Esempio n. 4
0
 public function testLocaleIsPassedToValueTransformer()
 {
     FormConfiguration::setDefaultLocale('de_DE');
     $transformer = $this->getMock('Symfony\\Component\\Form\\ValueTransformer\\ValueTransformerInterface');
     $transformer->expects($this->exactly(1))->method('setLocale')->with($this->equalTo('de_DE'));
     $field = new TestField('title', array('value_transformer' => $transformer));
 }
Esempio n. 5
0
 protected function setUp()
 {
     FormConfiguration::setDefaultLocale('de_AT');
 }