public function testLocale3() { $adapter = new Adapter\Qt(__DIR__ . '/_files/translation_en.ts', 'en'); set_error_handler(array($this, 'errorHandlerIgnore')); $adapter->setLocale('it'); restore_error_handler(); $this->assertEquals('it', $adapter->getLocale()); }
public function testLocale() { $adapter = new Adapter\Qt(__DIR__ . '/_files/translation_en.ts', '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()); }