Drupal Test Helpers module API documentation - release 1.3.1

ConfigurableLanguageManagerStub extends ConfigurableLanguageManager
in package

A stub of the Drupal's default ConfigurableLanguageManager class.

@package TestHelpers\DrupalServiceStubs

Table of Contents

Properties

$stubDefaultLanguage  : string
A default stub language.

Methods

__construct()  : mixed
{@inheritdoc}
getCurrentLanguage()  : mixed
{@inheritdoc}
languageValuesFromCode()  : array<string|int, mixed>
Generates value from langcode.
stubAddLanguage()  : mixed
Adds a language to the stub.
stubAddLanguages()  : mixed
Adds languages to the stub.
stubSetCurrentLanguage()  : mixed
Sets current language.
stubClearStaticCaches()  : mixed
Clears all static caches for the service.

Properties

Methods

__construct()

{@inheritdoc}

public __construct([LanguageDefault $default_language = NULL ][, ConfigFactoryInterface $config_factory = NULL ][, ModuleHandlerInterface $module_handler = NULL ][, LanguageConfigFactoryOverrideInterface $config_override = NULL ][, RequestStack $request_stack = NULL ]) : mixed
Parameters
$default_language : LanguageDefault = NULL
$config_factory : ConfigFactoryInterface = NULL
$module_handler : ModuleHandlerInterface = NULL
$config_override : LanguageConfigFactoryOverrideInterface = NULL
$request_stack : RequestStack = NULL

getCurrentLanguage()

{@inheritdoc}

public getCurrentLanguage([mixed $type = LanguageInterface::TYPE_INTERFACE ]) : mixed
Parameters
$type : mixed = LanguageInterface::TYPE_INTERFACE

languageValuesFromCode()

Generates value from langcode.

public languageValuesFromCode(string $langcode[, string|null $label = NULL ]) : array<string|int, mixed>
Parameters
$langcode : string

A langcode to use.

$label : string|null = NULL

A label to use, if NULL - gets from the standard list or use langcode in brackets, if no matches.

Return values
array<string|int, mixed>

An array with values for creating a Language object.

stubAddLanguage()

Adds a language to the stub.

public stubAddLanguage(string $code[, string|null $label = NULL ]) : mixed
Parameters
$code : string

A language code.

$label : string|null = NULL

A label for the language, if NULL - getted from standart list.

stubAddLanguages()

Adds languages to the stub.

public stubAddLanguages(array<string|int, mixed> $languagecodes) : mixed
Parameters
$languagecodes : array<string|int, mixed>

A list of languages codes.

stubSetCurrentLanguage()

Sets current language.

public stubSetCurrentLanguage(string|LanguageInterface $language) : mixed
Parameters
$language : string|LanguageInterface

A language code or a LanguageInterface object to set.


        
On this page

Search results