Drupal 8  8.0.2
LocaleConfigSubscriberTest Class Reference
Inheritance diagram for LocaleConfigSubscriberTest:

Public Member Functions

 testCreateTranslation ()
 
 testLocaleCreateTranslation ()
 
 testUpdateTranslation ()
 
 testLocaleUpdateTranslation ()
 
 testDeleteTranslation ()
 
 testLocaleDeleteTranslation ()
 

Static Public Attributes

static $modules = ['language', 'locale', 'system']
 

Protected Member Functions

 setUp ()
 
 setUpDefaultLanguage ()
 
 setUpLanguages ()
 
 setUpLocale ()
 
 setUpNoTranslation ($config_name, $key, $source, $langcode)
 
 setUpTranslation ($config_name, $key, $source, $translation, $langcode, $is_active=FALSE)
 
 saveLanguageOverride ($config_name, $key, $value, $langcode)
 
 saveLocaleTranslationData ($config_name, $key, $source, $translation, $langcode, $is_active=FALSE)
 
 deleteLanguageOverride ($config_name, $key, $source_value, $langcode)
 
 deleteLocaleTranslationData ($config_name, $key, $source_value, $langcode)
 
 assertNoConfigOverride ($config_name, $langcode)
 
 assertConfigOverride ($config_name, $key, $value, $langcode)
 
 assertActiveConfig ($config_name, $key, $value, $langcode)
 
 assertNoTranslation ($config_name, $langcode)
 

Protected Attributes

 $languageManager
 
 $configFactory
 
 $stringStorage
 
 $localeConfigManager
 

Detailed Description

Tests that shipped configuration translations are updated correctly.

locale

Member Function Documentation

assertActiveConfig (   $config_name,
  $key,
  $value,
  $langcode 
)
protected

Ensures configuration was saved correctly.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$valueThe configuration value.
string$langcodeThe language code.
Returns
bool TRUE if the assertion succeeded, FALSE otherwise.

References Drupal\configFactory().

Referenced by LocaleConfigSubscriberForeignTest\saveLanguageActive(), LocaleConfigSubscriberTest\saveLocaleTranslationData(), and LocaleConfigSubscriberTest\setUpTranslation().

Here is the call graph for this function:

Here is the caller graph for this function:

assertConfigOverride (   $config_name,
  $key,
  $value,
  $langcode 
)
protected

Ensures configuration was saved correctly.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$valueThe configuration value.
string$langcodeThe language code.
Returns
bool TRUE if the assertion succeeded, FALSE otherwise.

References Drupal\configFactory(), and Drupal\languageManager().

Referenced by LocaleConfigSubscriberTest\saveLanguageOverride(), LocaleConfigSubscriberTest\saveLocaleTranslationData(), LocaleConfigSubscriberTest\setUpTranslation(), and LocaleConfigSubscriberForeignTest\testEnglish().

Here is the call graph for this function:

Here is the caller graph for this function:

assertNoConfigOverride (   $config_name,
  $langcode 
)
protected

Ensures configuration override is not present anymore.

Parameters
string$config_nameThe configuration name.
string$langcodeThe language code.
Returns
bool TRUE if the assertion succeeded, FALSE otherwise.

References Drupal\configFactory(), and Drupal\languageManager().

Referenced by LocaleConfigSubscriberTest\deleteLanguageOverride(), LocaleConfigSubscriberTest\deleteLocaleTranslationData(), LocaleConfigSubscriberTest\setUpNoTranslation(), and LocaleConfigSubscriberForeignTest\testEnglish().

Here is the call graph for this function:

Here is the caller graph for this function:

assertNoTranslation (   $config_name,
  $langcode 
)
protected

Ensures no translation exists.

Parameters
string$config_nameThe configuration name.
string$langcodeThe language code.
Returns
bool TRUE if the assertion succeeded, FALSE otherwise.

Referenced by LocaleConfigSubscriberTest\setUpNoTranslation(), and LocaleConfigSubscriberTest\testLocaleDeleteTranslation().

Here is the caller graph for this function:

deleteLanguageOverride (   $config_name,
  $key,
  $source_value,
  $langcode 
)
protected

Deletes a language override.

This will invoke LocaleConfigSubscriber through the event dispatcher. To make sure the configuration was persisted correctly, the configuration value is checked. Because LocaleConfigSubscriber temporarily disables the override state of the configuration factory we check that the correct value is restored afterwards.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$source_valueThe source configuration value to verify the correct value is returned from the configuration factory after the deletion.
string$langcodeThe language code.

References LocaleConfigSubscriberTest\assertNoConfigOverride(), Drupal\configFactory(), and Drupal\languageManager().

Referenced by LocaleConfigSubscriberForeignTest\testDeleteTranslation(), and LocaleConfigSubscriberTest\testDeleteTranslation().

Here is the call graph for this function:

Here is the caller graph for this function:

deleteLocaleTranslationData (   $config_name,
  $key,
  $source_value,
  $langcode 
)
protected

Deletes translation data from locale module.

This will invoke LocaleConfigSubscriber through the event dispatcher. To make sure the configuration was persisted correctly, the configuration value is checked. Because LocaleConfigSubscriber temporarily disables the override state of the configuration factory we check that the correct value is restored afterwards.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$source_valueThe source configuration value to verify the correct value is returned from the configuration factory after the deletion.
string$langcodeThe language code.

References LocaleConfigSubscriberTest\assertNoConfigOverride(), and Drupal\configFactory().

Referenced by LocaleConfigSubscriberForeignTest\testEnglish(), LocaleConfigSubscriberForeignTest\testLocaleDeleteActiveTranslation(), and LocaleConfigSubscriberTest\testLocaleDeleteTranslation().

Here is the call graph for this function:

Here is the caller graph for this function:

saveLanguageOverride (   $config_name,
  $key,
  $value,
  $langcode 
)
protected

Saves a language override.

This will invoke LocaleConfigSubscriber through the event dispatcher. To make sure the configuration was persisted correctly, the configuration value is checked. Because LocaleConfigSubscriber temporarily disables the override state of the configuration factory we check that the correct value is restored afterwards.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$valueThe configuration value to save.
string$langcodeThe language code.

References LocaleConfigSubscriberTest\assertConfigOverride(), Drupal\configFactory(), and Drupal\languageManager().

Referenced by LocaleConfigSubscriberTest\testCreateTranslation(), LocaleConfigSubscriberForeignTest\testEnglish(), and LocaleConfigSubscriberTest\testUpdateTranslation().

Here is the call graph for this function:

Here is the caller graph for this function:

saveLocaleTranslationData (   $config_name,
  $key,
  $source,
  $translation,
  $langcode,
  $is_active = FALSE 
)
protected

Saves translation data from locale module.

This will invoke LocaleConfigSubscriber through the event dispatcher. To make sure the configuration was persisted correctly, the configuration value is checked. Because LocaleConfigSubscriber temporarily disables the override state of the configuration factory we check that the correct value is restored afterwards.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$sourceThe source string.
string$translationThe translation string to save.
string$langcodeThe language code.
bool$is_activeWhether the update will affect the active configuration.

References LocaleConfigSubscriberTest\assertActiveConfig(), LocaleConfigSubscriberTest\assertConfigOverride(), and Drupal\configFactory().

Referenced by LocaleConfigSubscriberForeignTest\testEnglish(), LocaleConfigSubscriberForeignTest\testLocaleCreateActiveTranslation(), LocaleConfigSubscriberTest\testLocaleCreateTranslation(), LocaleConfigSubscriberForeignTest\testLocaleUpdateActiveTranslation(), and LocaleConfigSubscriberTest\testLocaleUpdateTranslation().

Here is the call graph for this function:

Here is the caller graph for this function:

setUp ( )
protected

{}

References Locale\config(), Drupal\configFactory(), Drupal\languageManager(), LocaleConfigSubscriberTest\setUpDefaultLanguage(), and LocaleConfigSubscriberTest\setUpLocale().

Here is the call graph for this function:

setUpDefaultLanguage ( )
protected

Sets up default language for this test.

Referenced by LocaleConfigSubscriberTest\setUp().

Here is the caller graph for this function:

setUpLanguages ( )
protected

Sets up languages needed for this test.

References ConfigurableLanguage\createFromLangcode().

Here is the call graph for this function:

setUpLocale ( )
protected

Sets up the locale storage strings to be in line with configuration.

References LocaleConfigSubscriberTest\setUpNoTranslation(), and LocaleConfigSubscriberTest\setUpTranslation().

Referenced by LocaleConfigSubscriberTest\setUp().

Here is the call graph for this function:

Here is the caller graph for this function:

setUpNoTranslation (   $config_name,
  $key,
  $source,
  $langcode 
)
protected

Sets up a configuration string without a translation.

The actual configuration is already available by installing locale_test module, as it is done in LocaleConfigSubscriberTest::setUp(). This sets up the necessary source string and verifies that everything is as expected to avoid false positives.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$sourceThe source string.
string$langcodeThe language code.

References LocaleConfigSubscriberTest\assertNoConfigOverride(), and LocaleConfigSubscriberTest\assertNoTranslation().

Referenced by LocaleConfigSubscriberTest\setUpLocale().

Here is the call graph for this function:

Here is the caller graph for this function:

setUpTranslation (   $config_name,
  $key,
  $source,
  $translation,
  $langcode,
  $is_active = FALSE 
)
protected

Sets up a configuration string with a translation.

The actual configuration is already available by installing locale_test module, as it is done in LocaleConfigSubscriberTest::setUp(). This sets up the necessary source and translation strings and verifies that everything is as expected to avoid false positives.

Parameters
string$config_nameThe configuration name.
string$keyThe configuration key.
string$sourceThe source string.
string$translationThe translation string.
string$langcodeThe language code.
bool$is_activeWhether the update will affect the active configuration.

References LocaleConfigSubscriberTest\assertActiveConfig(), LocaleConfigSubscriberTest\assertConfigOverride(), and Drupal\configFactory().

Referenced by LocaleConfigSubscriberForeignTest\setUpLocale(), and LocaleConfigSubscriberTest\setUpLocale().

Here is the call graph for this function:

Here is the caller graph for this function:

testCreateTranslation ( )

Tests creating translations of shipped configuration.

References LocaleConfigSubscriberTest\saveLanguageOverride().

Here is the call graph for this function:

testDeleteTranslation ( )

Tests deleting translations of shipped configuration.

References LocaleConfigSubscriberTest\deleteLanguageOverride().

Here is the call graph for this function:

testLocaleCreateTranslation ( )

Tests importing community translations of shipped configuration.

References LocaleConfigSubscriberTest\saveLocaleTranslationData().

Here is the call graph for this function:

testLocaleDeleteTranslation ( )

Tests deleting community translations of shipped configuration.

References LocaleConfigSubscriberTest\assertNoTranslation(), and LocaleConfigSubscriberTest\deleteLocaleTranslationData().

Here is the call graph for this function:

testLocaleUpdateTranslation ( )

Tests updating community translations of shipped configuration.

References LocaleConfigSubscriberTest\saveLocaleTranslationData().

Here is the call graph for this function:

testUpdateTranslation ( )

Tests updating translations of shipped configuration.

References LocaleConfigSubscriberTest\saveLanguageOverride().

Here is the call graph for this function:

Field Documentation

$modules = ['language', 'locale', 'system']
static

{}


The documentation for this class was generated from the following file: