Ejemplo n.º 1
0
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/translation.ini', 'en');
     $this->assertEquals('en', $adapter->getLocale());
     $locale = new Zend_Locale('en');
     $adapter->setLocale($locale);
     $this->assertEquals('en', $adapter->getLocale());
     try {
         $adapter->setLocale('nolocale');
         $this->fail("exception expected");
     } catch (Zend_Translate_Exception $e) {
         // success
     }
     try {
         $adapter->setLocale('de');
         $this->fail("exception expected");
     } catch (Zend_Translate_Exception $e) {
         // success
     }
 }
Ejemplo n.º 2
0
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/translation_en.ini', 'en');
     $this->assertEquals('en', $adapter->getLocale());
     $locale = new Zend_Locale('en');
     $adapter->setLocale($locale);
     $this->assertEquals('en', $adapter->getLocale());
     try {
         $adapter->setLocale('nolocale');
         $this->fail("exception expected");
     } catch (Zend_Translate_Exception $e) {
         $this->assertContains('The given Language', $e->getMessage());
     }
     set_error_handler(array($this, 'errorHandlerIgnore'));
     $adapter->setLocale('de');
     restore_error_handler();
     $this->assertEquals('de', $adapter->getLocale());
 }