You are here

public function MockLanguageManager::getCurrentLanguage in Token 8

Returns the current language for the given type.

Parameters

string $type: (optional) The language type; e.g., the interface or the content language. Defaults to \Drupal\Core\Language\LanguageInterface::TYPE_INTERFACE.

Return value

\Drupal\Core\Language\LanguageInterface The current language object for the given type of language.

Overrides ConfigurableLanguageManager::getCurrentLanguage

File

tests/src/Kernel/MockLanguageManager.php, line 23

Class

MockLanguageManager
A language manager that can be easily overridden for testing purposes.

Namespace

Drupal\Tests\token\Kernel

Code

public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) {
  if (isset($this->currentLanguages[$type])) {
    return $this->currentLanguages[$type];
  }
  return parent::getCurrentLanguage($type);
}