public function testTranslatorMethods() { $translatorMock = $this->getMock('Zend\\I18n\\Translator\\Translator'); $this->helper->setTranslator($translatorMock, 'foo'); $this->assertEquals($translatorMock, $this->helper->getTranslator()); $this->assertEquals('foo', $this->helper->getTranslatorTextDomain()); $this->assertTrue($this->helper->hasTranslator()); $this->assertTrue($this->helper->isTranslatorEnabled()); $this->helper->setTranslatorEnabled(false); $this->assertFalse($this->helper->isTranslatorEnabled()); }
public function testCanTranslateTitle() { $loader = new TestAsset\ArrayTranslator(); $loader->translations = array('Message_1' => 'Message 1 (en)'); $translator = new Translator(); $translator->getPluginManager()->setService('default', $loader); $translator->addTranslationFile('default', null); $this->helper->enableTranslation(); $this->helper->setTranslator($translator); $this->helper->__invoke('Message_1'); $this->assertEquals('<title>Message 1 (en)</title>', $this->helper->toString()); }