You are here

public function MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation in Drupal 10

Same name in this branch
  1. 10 core/modules/field/tests/src/Kernel/Migrate/d6/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d6\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
  2. 10 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()
Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldInstanceOptionTranslationTest::testFieldInstanceOptionTranslation()

Migrate field instance option translations.

File

core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceOptionTranslationTest.php, line 52

Class

MigrateFieldInstanceOptionTranslationTest
Migrate field instance option translations.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

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.blog.field_boolean');
  $this
    ->assertNull($config_translation
    ->get('settings'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('is', 'field.field.node.blog.field_boolean');
  $option_translation = [
    'off_label' => 'is - Off',
    'on_label' => 'is - 1',
  ];
  $this
    ->assertSame($option_translation, $config_translation
    ->get('settings'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.field.node.test_content_type.field_boolean');
  $this
    ->assertNull($config_translation
    ->get('settings'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_boolean');
  $this
    ->assertSame($option_translation, $config_translation
    ->get('settings'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.field.node.article.field_checkbox');
  $option_translation = [
    'off_label' => 'fr - Stop',
    'on_label' => 'Go',
  ];
  $this
    ->assertSame($option_translation, $config_translation
    ->get('settings'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('is', 'field.field.node.article.field_checkbox');
  $option_translation = [
    'off_label' => 'is - Stop',
    'on_label' => 'is - Go',
  ];
  $this
    ->assertSame($option_translation, $config_translation
    ->get('settings'));
}