function TranslationTest::setUp
Same name in this branch
- 11.x core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php \Drupal\Tests\Core\Annotation\TranslationTest::setUp()
Same name in other branches
- 9 core/modules/field/tests/src/Kernel/TranslationTest.php \Drupal\Tests\field\Kernel\TranslationTest::setUp()
- 9 core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php \Drupal\Tests\Core\Annotation\TranslationTest::setUp()
- 8.9.x core/modules/field/tests/src/Kernel/TranslationTest.php \Drupal\Tests\field\Kernel\TranslationTest::setUp()
- 8.9.x 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()
- 10 core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php \Drupal\Tests\Core\Annotation\TranslationTest::setUp()
Overrides FieldKernelTestBase::setUp
File
-
core/
modules/ field/ tests/ src/ Kernel/ TranslationTest.php, line 74
Class
- TranslationTest
- Tests multilingual fields logic.
Namespace
Drupal\Tests\field\KernelCode
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('node');
$this->installConfig([
'language',
]);
$this->fieldName = $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();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.