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(); }
/** * @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(); } }
/** * @dataProvider canonicalPropertyLabelsProvider */ public function testGetCanonicalPropertyLabels($languageCode, $aliasMatch, $expected) { $extraneousLanguage = ExtraneousLanguage::getInstance()->fetchByLanguageCode($languageCode); $propertyLabels = $extraneousLanguage->getCanonicalPropertyLabels(); $this->assertEquals($expected, $propertyLabels[$aliasMatch]); }
/** * @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); }