Пример #1
0
 public function testCreateLocaleSettings()
 {
     $settings = array('basedOn' => 'no', 'nested' => false);
     $result = $this->Translation->createLocale('da', $settings);
     $expected = Translation::forLocale('no', $settings);
     $this->assertSame($expected, $result);
 }
 /**
  * testCreateNotDefaultLanguage
  *
  * If a record is created in a not-default language, it should still store
  * in the original field the translated value. While this isn't particularly
  * correct - it's better than the original translated field being blank in the
  * default language - and therefore in all other langauges.
  *
  * @return void
  */
 public function testCreateNotDefaultLanguage()
 {
     Configure::write('Config.defaultLanguage', 'en');
     Configure::write('Config.language', 'es');
     $this->Tag->create();
     $this->Tag->save(array('tag' => 'nuevo'));
     $expected = array(1 => 'tag1', 'tag2', 'tag3', 'nuevo');
     $this->Tag->Behaviors->disable('Translate');
     $result = $this->Tag->find('list');
     $this->assertSame($expected, $result);
     $this->Tag->Behaviors->enable('Translate');
     $result = $this->Tag->find('list');
     $this->assertSame($expected, $result);
     $expected = array('Tag.1.tag' => 'tag1', 'Tag.2.tag' => 'tag2', 'Tag.3.tag' => 'tag3', 'Tag.4.tag' => 'nuevo');
     $translations = Translation::forLocale('en', array('domain' => 'data', 'section' => 'Tag', 'nested' => false));
     ksort($translations);
     $this->assertSame($expected, $translations);
 }