You are here

public function MigrateProfileFieldOptionTranslationTest::testFieldOptionTranslation in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateProfileFieldOptionTranslationTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateProfileFieldOptionTranslationTest::testFieldOptionTranslation()
  2. 10 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateProfileFieldOptionTranslationTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateProfileFieldOptionTranslationTest::testFieldOptionTranslation()

Tests the Drupal 6 field option translation.

File

core/modules/user/tests/src/Kernel/Migrate/d6/MigrateProfileFieldOptionTranslationTest.php, line 40

Class

MigrateProfileFieldOptionTranslationTest
Tests field option translations migration.

Namespace

Drupal\Tests\user\Kernel\Migrate\d6

Code

public function testFieldOptionTranslation() {
  $language_manager = $this->container
    ->get('language_manager');

  /** @var \Drupal\language\Config\LanguageConfigOverride $config_translation */
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.storage.user.profile_count_trees');
  $allowed_values = [
    0 => [
      'label' => 'fr - 10',
    ],
    1 => [
      'label' => 'fr - 20',
    ],
    2 => [
      'label' => 'fr - 50',
    ],
    3 => [
      'label' => 'fr - 100',
    ],
    4 => [
      'label' => 'fr - 1000',
    ],
  ];
  $this
    ->assertSame($allowed_values, $config_translation
    ->get('settings.allowed_values'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.storage.user.profile_sold_to');
  $allowed_values = [
    [
      'label' => 'fr - Pill spammers Fitness spammers Back\\slash Forward/slash Dot.in.the.middle',
    ],
  ];
  $this
    ->assertSame($allowed_values, $config_translation
    ->get('settings.allowed_values'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('zu', 'field.storage.user.profile_sold_to');
  $allowed_values = [
    [
      'label' => 'zu - Pill spammers Fitness spammers Back\\slash Forward/slash Dot.in.the.middle',
    ],
  ];
  $this
    ->assertSame($allowed_values, $config_translation
    ->get('settings.allowed_values'));
}