public function testLocale3() { $adapter = new Adapter\Tbx(__DIR__ . '/_files/translation_en.tbx', 'fr'); set_error_handler(array($this, 'errorHandlerIgnore')); $adapter->setLocale('ru'); restore_error_handler(); $this->assertEquals('ru', $adapter->getLocale()); }
public function testLocale() { $adapter = new Adapter\Tbx(__DIR__ . '/_files/translation_en.tbx', 'fr'); $this->assertEquals('fr', $adapter->getLocale()); $locale = new Locale\Locale('fr'); $adapter->setLocale($locale); $this->assertEquals('fr', $adapter->getLocale()); try { $adapter->setLocale('nolocale'); $this->fail("exception expected"); } catch (Translator\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()); }