MockLanguageManager.php in Token 8
File
tests/src/Kernel/MockLanguageManager.php
View source
<?php
namespace Drupal\Tests\token\Kernel;
use Drupal\Core\Language\LanguageInterface;
use Drupal\language\ConfigurableLanguageManager;
class MockLanguageManager extends ConfigurableLanguageManager {
protected $currentLanguages;
public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) {
if (isset($this->currentLanguages[$type])) {
return $this->currentLanguages[$type];
}
return parent::getCurrentLanguage($type);
}
public function setCurrentLanguage($type, LanguageInterface $language) {
$this->currentLanguages[$type] = $language;
}
}