コード例 #1
0
 public function testCanConstruct()
 {
     $languageContents = $this->getMockBuilder(LanguageContents::class)->disableOriginalConstructor()->getMock();
     $this->assertInstanceOf(ExtraneousLanguage::class, new ExtraneousLanguage($languageContents));
     $this->assertInstanceOf(ExtraneousLanguage::class, ExtraneousLanguage::getInstance());
     ExtraneousLanguage::clear();
 }
コード例 #2
0
 /**
  * @since 1.9
  *
  * @param array &$globalVars
  * @param ExtraneousLanguage|null $extraneousLanguage
  */
 public function __construct(&$globalVars, ExtraneousLanguage $extraneousLanguage = null)
 {
     $this->globalVars =& $globalVars;
     $this->extraneousLanguage = $extraneousLanguage;
     if ($this->extraneousLanguage === null) {
         $this->extraneousLanguage = ExtraneousLanguage::getInstance();
     }
 }
コード例 #3
0
 /**
  * @dataProvider canonicalPropertyLabelsProvider
  */
 public function testGetCanonicalPropertyLabels($languageCode, $aliasMatch, $expected)
 {
     $extraneousLanguage = ExtraneousLanguage::getInstance()->fetchByLanguageCode($languageCode);
     $propertyLabels = $extraneousLanguage->getCanonicalPropertyLabels();
     $this->assertEquals($expected, $propertyLabels[$aliasMatch]);
 }
コード例 #4
0
 /**
  * @since 2.4
  *
  * @param Language|string $languageCode
  *
  * @return ExtraneousLanguage
  */
 public function getExtraneousLanguage($language = '')
 {
     $languageCode = $language;
     if ($language instanceof Language) {
         $languageCode = $language->getCode();
     }
     if ($languageCode === '' || !$languageCode || $languageCode === null) {
         $languageCode = $this->getContentLanguage()->getCode();
     }
     return ExtraneousLanguage::getInstance()->fetchByLanguageCode($languageCode);
 }
 private function loadLanguageFileAndConstructClass($langcode)
 {
     return ExtraneousLanguage::getInstance()->fetchByLanguageCode($langcode);
 }