public function testLocale()
 {
     $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/translation_en.xmltm', '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('ar');
     restore_error_handler();
     $this->assertEquals('ar', $adapter->getLocale());
 }
Ejemplo n.º 2
0
    public function testLocale()
    {
        $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/XmlTm_test_en.xml', '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
        }
    }