public function LocaleTranslatedSchemaDefinitionTest::testTranslatedSchemaDefinition in Drupal 9
Same name and namespace in other branches
- 8 core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php \Drupal\Tests\locale\Functional\LocaleTranslatedSchemaDefinitionTest::testTranslatedSchemaDefinition()
Tests that translated field descriptions do not affect the update system.
File
- core/
modules/ locale/ tests/ src/ Functional/ LocaleTranslatedSchemaDefinitionTest.php, line 46
Class
- LocaleTranslatedSchemaDefinitionTest
- Adds and configures languages to check field schema definition.
Namespace
Drupal\Tests\locale\FunctionalCode
public function testTranslatedSchemaDefinition() {
/** @var \Drupal\locale\StringDatabaseStorage $stringStorage */
$stringStorage = \Drupal::service('locale.storage');
$source = $stringStorage
->createString([
'source' => 'Revision ID',
])
->save();
$stringStorage
->createTranslation([
'lid' => $source->lid,
'language' => 'fr',
'translation' => 'Translated Revision ID',
])
->save();
// Ensure that the field is translated when access through the API.
$this
->assertEquals('Translated Revision ID', \Drupal::service('entity_field.manager')
->getBaseFieldDefinitions('node')['vid']
->getLabel());
// Assert there are no updates.
$this
->assertFalse(\Drupal::service('entity.definition_update_manager')
->needsUpdates());
}