Exemplo n.º 1
0
 public function testLocale3()
 {
     $adapter = new Adapter\Xliff(__DIR__ . '/_files/translation_en.xliff', 'en');
     set_error_handler(array($this, 'errorHandlerIgnore'));
     $adapter->setLocale('it');
     restore_error_handler();
     $this->assertEquals('it', $adapter->getLocale());
 }
Exemplo n.º 2
0
 public function testLocale()
 {
     $adapter = new Adapter\Xliff(__DIR__ . '/_files/translation_en.xliff', 'en');
     $this->assertEquals('en', $adapter->getLocale());
     $locale = new Locale\Locale('en');
     $adapter->setLocale($locale);
     $this->assertEquals('en', $adapter->getLocale());
     try {
         $adapter->setLocale('nolocale');
         $this->fail("exception expected");
     } catch (Translator\Exception\InvalidArgumentException $e) {
         $this->assertContains('does not exist', $e->getMessage());
     }
     set_error_handler(array($this, 'errorHandlerIgnore'));
     $adapter->setLocale('it');
     restore_error_handler();
     $this->assertEquals('it', $adapter->getLocale());
 }