Tests remote languages mappings support in the tmgmt core.
public function testRemoteLanguagesMappings() {
$mappings = $this->default_translator
->getRemoteLanguagesMappings();
$this
->assertEquals(array(
'en' => 'en-us',
'de' => 'de-ch',
'el' => 'el',
'es' => 'es',
), $mappings);
$this
->assertEquals('en-us', $this->default_translator
->mapToRemoteLanguage('en'));
$this
->assertEquals('de-ch', $this->default_translator
->mapToRemoteLanguage('de'));
$remote_language_mappings = $this->default_translator
->get('remote_languages_mappings');
$remote_language_mappings['de'] = 'de-de';
$remote_language_mappings['en'] = 'en-uk';
$this->default_translator
->set('remote_languages_mappings', $remote_language_mappings);
$this->default_translator
->save();
$this
->assertEquals('en-uk', $this->default_translator
->mapToRemoteLanguage('en'));
$this
->assertEquals('de-de', $this->default_translator
->mapToRemoteLanguage('de'));
// Test the fallback.
$this->container
->get('state')
->set('tmgmt_test_translator_map_languages', FALSE);
$this->container
->get('plugin.manager.tmgmt.translator')
->clearCachedDefinitions();
$this
->assertEquals('en', $this->default_translator
->mapToRemoteLanguage('en'));
$this
->assertEquals('de', $this->default_translator
->mapToRemoteLanguage('de'));
}