You are here

public function MigrateFieldInstanceLabelDescriptionTest::testFieldInstanceLabelDescriptionTranslationMigration in Drupal 10

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

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

File

core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceLabelDescriptionTest.php, line 79

Class

MigrateFieldInstanceLabelDescriptionTest
Tests migration field label and description i18n translations.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

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

  // Check that the deleted field with translations was skipped.
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.field.node.article.field_image');
  $this
    ->assertNull($config_translation
    ->get('label'));
  $this
    ->assertNull($config_translation
    ->get('description'));

  // Tests fields on 'test_content_type' node type.
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.field.node.test_content_type.field_email');
  $this
    ->assertNull($config_translation
    ->get('label'));
  $this
    ->assertSame("fr - The email help text.", $config_translation
    ->get('description'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_email');
  $this
    ->assertSame("is - Email", $config_translation
    ->get('label'));
  $this
    ->assertSame("is - The email help text.", $config_translation
    ->get('description'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('is', 'field.field.node.test_content_type.field_boolean');
  $this
    ->assertSame("is - Some helpful text.", $config_translation
    ->get('description'));

  // Tests fields on 'article' node type.
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.field.node.article.body');
  $this
    ->assertSame("fr - Body", $config_translation
    ->get('label'));
  $config_translation = $language_manager
    ->getLanguageConfigOverride('fr', 'field.field.node.article.field_link');
  $this
    ->assertSame("fr - Link", $config_translation
    ->get('label'));

  // Tests fields on 'test_vocabulary' vocabulary type.
  $config_translation = $language_manager
    ->getLanguageConfigOverride('is', 'field.field.taxonomy_term.test_vocabulary.field_term_reference');
  $this
    ->assertSame("is - Term Reference", $config_translation
    ->get('label'));
}