View source
<?php
namespace Drupal\Tests\field\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateFieldOptionTranslationTest extends MigrateDrupal6TestBase {
protected static $modules = [
'config_translation',
'language',
'locale',
'menu_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->executeMigrations([
'language',
'd6_field',
'd6_field_option_translation',
]);
}
public function testFieldOptionTranslation() {
$language_manager = $this->container
->get('language_manager');
$config_translation = $language_manager
->getLanguageConfigOverride('fr', 'field.storage.node.field_test_integer_selectlist');
$allowed_values = [
1 => [
'label' => 'fr - 2341',
],
3 => [
'label' => 'fr - 4123',
],
];
$this
->assertSame($allowed_values, $config_translation
->get('settings.allowed_values'));
$config_translation = $language_manager
->getLanguageConfigOverride('zu', 'field.storage.node.field_test_integer_selectlist');
$allowed_values = [
1 => [
'label' => 'zu - 2341',
],
];
$this
->assertSame($allowed_values, $config_translation
->get('settings.allowed_values'));
$config_translation = $language_manager
->getLanguageConfigOverride('fr', 'field.storage.node.field_test_string_selectlist');
$allowed_values = [
0 => [
'label' => 'Noir',
],
];
$this
->assertSame($allowed_values, $config_translation
->get('settings.allowed_values'));
$config_translation = $language_manager
->getLanguageConfigOverride('zu', 'field.storage.node.field_test_string_selectlist');
$allowed_values = [
0 => [
'label' => 'Okumnyama',
],
1 => [
'label' => 'Mhlophe',
],
];
$this
->assertSame($allowed_values, $config_translation
->get('settings.allowed_values'));
}
}