class MockLanguageManager in Token 8
A language manager that can be easily overridden for testing purposes.
Hierarchy
- class \Drupal\Core\Language\LanguageManager implements LanguageManagerInterface uses DependencySerializationTrait
- class \Drupal\language\ConfigurableLanguageManager implements ConfigurableLanguageManagerInterface
- class \Drupal\Tests\token\Kernel\MockLanguageManager
- class \Drupal\language\ConfigurableLanguageManager implements ConfigurableLanguageManagerInterface
Expanded class hierarchy of MockLanguageManager
File
- tests/
src/ Kernel/ MockLanguageManager.php, line 11
Namespace
Drupal\Tests\token\KernelView source
class MockLanguageManager extends ConfigurableLanguageManager {
/**
* List of current languages used in the test.
*
* @var \Drupal\Core\Language\LanguageInterface[]
*/
protected $currentLanguages;
/**
* {@inheritdoc}
*/
public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) {
if (isset($this->currentLanguages[$type])) {
return $this->currentLanguages[$type];
}
return parent::getCurrentLanguage($type);
}
/**
* Sets the current language of the given type to use during tests.
*
* @param string $type
* The language type.
* @param \Drupal\Core\Language\LanguageInterface $language
* The language.
*/
public function setCurrentLanguage($type, LanguageInterface $language) {
$this->currentLanguages[$type] = $language;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableLanguageManager:: |
protected | property | The configuration storage service. | |
ConfigurableLanguageManager:: |
protected | property | The language configuration override service. | |
ConfigurableLanguageManager:: |
protected | property | Whether or not the language manager has been initialized. | |
ConfigurableLanguageManager:: |
protected | property | Whether language types are in the process of language initialization. | |
ConfigurableLanguageManager:: |
protected | property | Local cache for language type configuration data. | |
ConfigurableLanguageManager:: |
protected | property | Local cache for language type information. | |
ConfigurableLanguageManager:: |
protected | property | The module handler service. | |
ConfigurableLanguageManager:: |
protected | property | An array of language objects keyed by language type. | |
ConfigurableLanguageManager:: |
protected | property | An array of language negotiation method IDs keyed by language type. | |
ConfigurableLanguageManager:: |
protected | property | The language negotiator. | |
ConfigurableLanguageManager:: |
protected | property | The request object. | |
ConfigurableLanguageManager:: |
public | function |
Gets the current configuration override language. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns all the defined language types including fixed ones. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns information about all defined language types. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns the language fallback candidates for a given context. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Gets a language config override object. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Gets a language configuration override storage object. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns a list of languages set up on the site. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns the language switch links for the given language type. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns an array of the available language types. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns a list of languages set up on the site in their native form. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Gets the negotiated language method ID. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns the language negotiator. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Returns the standard language list excluding already configured languages. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function | ||
ConfigurableLanguageManager:: |
public | function |
Returns whether or not the site has more than one language added. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
protected | function | Retrieves language types from the configuration storage. | |
ConfigurableLanguageManager:: |
public static | function |
Rebuild the container to register services needed on multilingual sites. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Resets the given language type or all types if none specified. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Stores language types configuration. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Sets the configuration override language. Overrides LanguageManager:: |
|
ConfigurableLanguageManager:: |
public | function |
Injects the language negotiator. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Updates locked system language weights. Overrides ConfigurableLanguageManagerInterface:: |
|
ConfigurableLanguageManager:: |
public | function |
Constructs a new ConfigurableLanguageManager object. Overrides LanguageManager:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
LanguageManager:: |
protected | property | The default language object. | |
LanguageManager:: |
protected | property | A static cache of translated language lists. | |
LanguageManager:: |
protected | function | Filters the full list of languages based on the value of the flag. | |
LanguageManager:: |
public | function |
Returns a language object representing the site's default language. Overrides LanguageManagerInterface:: |
|
LanguageManager:: |
public | function |
Returns a list of the default locked languages. Overrides LanguageManagerInterface:: |
|
LanguageManager:: |
public | function |
Returns a language object from the given language code. Overrides LanguageManagerInterface:: |
|
LanguageManager:: |
public | function |
Produced the printed name for a language for display. Overrides LanguageManagerInterface:: |
|
LanguageManager:: |
public static | function |
Some common languages with their English and native names. Overrides LanguageManagerInterface:: |
|
LanguageManager:: |
public static | function | The 6 official languages used at the United Nations. | |
LanguageManager:: |
public | function |
Checks whether a language is locked. Overrides LanguageManagerInterface:: |
|
MockLanguageManager:: |
protected | property | List of current languages used in the test. | |
MockLanguageManager:: |
public | function |
Returns the current language for the given type. Overrides ConfigurableLanguageManager:: |
|
MockLanguageManager:: |
public | function | Sets the current language of the given type to use during tests. |