Ejemplo n.º 1
0
 public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/translation_en.tbx', 'fr');
     $this->assertEquals('fr', $adapter->getLocale());
     $locale = new Zend_Locale('fr');
     $adapter->setLocale($locale);
     $this->assertEquals('fr', $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('ru');
     restore_error_handler();
     $this->assertEquals('ru', $adapter->getLocale());
 }
Ejemplo n.º 2
0
    public function testLocale()
    {
        $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/translation_en.tbx', '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('ar');
            $this->fail("exception expected");
        } catch (Zend_Translate_Exception $e) {
            // success
        }
    }