protected function TranslationTest::setUp in Drupal 10
Same name in this branch
- 10 core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php \Drupal\Tests\Core\Annotation\TranslationTest::setUp()
- 10 core/modules/field/tests/src/Kernel/TranslationTest.php \Drupal\Tests\field\Kernel\TranslationTest::setUp()
Same name and namespace in other branches
- 8 core/modules/field/tests/src/Kernel/TranslationTest.php \Drupal\Tests\field\Kernel\TranslationTest::setUp()
- 9 core/modules/field/tests/src/Kernel/TranslationTest.php \Drupal\Tests\field\Kernel\TranslationTest::setUp()
File
- core/
modules/ field/ tests/ src/ Kernel/ TranslationTest.php, line 73
Class
- TranslationTest
- Tests multilanguage fields logic.
Namespace
Drupal\Tests\field\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('node');
$this
->installConfig([
'language',
]);
$this->fieldName = mb_strtolower($this
->randomMachineName());
$this->entityType = 'entity_test';
$this->fieldStorageDefinition = [
'field_name' => $this->fieldName,
'entity_type' => $this->entityType,
'type' => 'test_field',
'cardinality' => 4,
];
$this->fieldStorage = FieldStorageConfig::create($this->fieldStorageDefinition);
$this->fieldStorage
->save();
$this->fieldDefinition = [
'field_storage' => $this->fieldStorage,
'bundle' => 'entity_test',
];
$this->field = FieldConfig::create($this->fieldDefinition);
$this->field
->save();
for ($i = 0; $i < 3; ++$i) {
ConfigurableLanguage::create([
'id' => 'l' . $i,
'label' => $this
->randomString(),
])
->save();
}
}