function MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d6\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
  2. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
  3. 10 core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d6\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
  4. 10 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
  5. 11.x core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d6\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
  6. 11.x core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()

Tests migration of file variables to file.settings.yml.

File

core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceOptionTranslationTest.php, line 44

Class

MigrateFieldInstanceOptionTranslationTest
Migrate field instance option translations.

Namespace

Drupal\Tests\field\Kernel\Migrate\d6

Code

public function testFieldInstanceOptionTranslation() {
    $language_manager = $this->container
        ->get('language_manager');
    
    /** @var \Drupal\language\Config\LanguageConfigOverride $config_translation */
    $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.story.field_test_float_single_checkbox');
    $option_translation = [
        'on_label' => 'fr - 1.234',
    ];
    $this->assertSame($option_translation, $config_translation->get('settings'));
    $config_translation = $language_manager->getLanguageConfigOverride('zu', 'field.field.node.story.field_test_float_single_checkbox');
    $option_translation = [
        'on_label' => 'zu - 1.234',
    ];
    $this->assertSame($option_translation, $config_translation->get('settings'));
    $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.story.field_test_text_single_checkbox');
    $option_translation = [
        'off_label' => 'fr - Hello',
        'on_label' => 'fr - Goodbye',
    ];
    $this->assertSame($option_translation, $config_translation->get('settings'));
    $config_translation = $language_manager->getLanguageConfigOverride('fr', 'field.field.node.story.field_test_text_single_checkbox2');
    $option_translation = [
        'off_label' => 'fr - Off',
        'on_label' => 'fr - Hello',
    ];
    $this->assertSame($option_translation, $config_translation->get('settings'));
    $config_translation = $language_manager->getLanguageConfigOverride('zu', 'field.field.node.story.field_test_text_single_checkbox2');
    $option_translation = [
        'on_label' => 'zu - Hello',
    ];
    $this->assertSame($option_translation, $config_translation->get('settings'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.