function LinkItemTest::setUp
Same name in other branches
- 9 core/modules/link/tests/src/Kernel/LinkItemTest.php \Drupal\Tests\link\Kernel\LinkItemTest::setUp()
- 8.9.x core/modules/link/tests/src/Kernel/LinkItemTest.php \Drupal\Tests\link\Kernel\LinkItemTest::setUp()
- 10 core/modules/link/tests/src/Kernel/LinkItemTest.php \Drupal\Tests\link\Kernel\LinkItemTest::setUp()
Overrides FieldKernelTestBase::setUp
File
-
core/
modules/ link/ tests/ src/ Kernel/ LinkItemTest.php, line 32
Class
- LinkItemTest
- Tests the new entity API for the link field type.
Namespace
Drupal\Tests\link\KernelCode
protected function setUp() : void {
parent::setUp();
// Create a generic, external, and internal link fields for validation.
FieldStorageConfig::create([
'field_name' => 'field_test',
'entity_type' => 'entity_test',
'type' => 'link',
])->save();
FieldConfig::create([
'entity_type' => 'entity_test',
'field_name' => 'field_test',
'bundle' => 'entity_test',
'settings' => [
'link_type' => LinkItemInterface::LINK_GENERIC,
],
])->save();
FieldStorageConfig::create([
'field_name' => 'field_test_external',
'entity_type' => 'entity_test',
'type' => 'link',
])->save();
FieldConfig::create([
'entity_type' => 'entity_test',
'field_name' => 'field_test_external',
'bundle' => 'entity_test',
'settings' => [
'link_type' => LinkItemInterface::LINK_EXTERNAL,
],
])->save();
FieldStorageConfig::create([
'field_name' => 'field_test_internal',
'entity_type' => 'entity_test',
'type' => 'link',
])->save();
FieldConfig::create([
'entity_type' => 'entity_test',
'field_name' => 'field_test_internal',
'bundle' => 'entity_test',
'settings' => [
'link_type' => LinkItemInterface::LINK_INTERNAL,
],
])->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.