コード例 #1
0
ファイル: AbstractTest.php プロジェクト: haoyanfei/zf2
 public function testDefaultTranslatorMethods()
 {
     $this->assertFalse(AbstractValidator::hasDefaultTranslator());
     $this->assertNull(AbstractValidator::getDefaultTranslator());
     $this->assertEquals('default', AbstractValidator::getDefaultTranslatorTextDomain());
     $this->assertFalse($this->validator->hasTranslator());
     $translatorMock = $this->getMock('Zend\\I18n\\Translator\\Translator');
     AbstractValidator::setDefaultTranslator($translatorMock, 'foo');
     $this->assertEquals($translatorMock, AbstractValidator::getDefaultTranslator());
     $this->assertEquals($translatorMock, $this->validator->getTranslator());
     $this->assertEquals('foo', AbstractValidator::getDefaultTranslatorTextDomain());
     $this->assertEquals('foo', $this->validator->getTranslatorTextDomain());
     $this->assertTrue(AbstractValidator::hasDefaultTranslator());
 }
コード例 #2
0
 /**
  * Return the translation text domain
  *
  * @return string
  */
 public function getTranslatorTextDomain()
 {
     if ($this->translatorTextDomain === null) {
         $this->translatorTextDomain = AbstractValidator::getDefaultTranslatorTextDomain();
     }
     return $this->translatorTextDomain;
 }