示例#1
0
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', 'en');
     $this->assertEquals($adapter->getLocale(), 'en');
     $locale = new Zend_Locale('en');
     $adapter->setLocale($locale);
     $this->assertEquals($adapter->getLocale(), 'en');
     try {
         $adapter->setLocale('nolocale');
         $this->fail();
     } catch (Zend_Translate_Exception $e) {
         // success
     }
     try {
         $adapter->setLocale('de');
         $this->fail();
     } catch (Zend_Translate_Exception $e) {
         // success
     }
 }
示例#2
0
文件: CsvTest.php 项目: netvlies/zf
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', '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('does not exist', $e->getMessage());
     }
     set_error_handler(array($this, 'errorHandlerIgnore'));
     $adapter->setLocale('de');
     restore_error_handler();
     $this->assertEquals('de', $adapter->getLocale());
 }