function LinkItemSerializationTest::setUp
Set the default field storage backend for fields created during tests.
Overrides FieldKernelTestBase::setUp
File
- 
              core/
modules/ link/ tests/ src/ Kernel/ LinkItemSerializationTest.php, line 34  
Class
- LinkItemSerializationTest
 - Tests link field serialization.
 
Namespace
Drupal\Tests\link\KernelCode
protected function setUp() {
  parent::setUp();
  $this->installEntitySchema('user');
  $this->serializer = \Drupal::service('serializer');
  // Create a generic, external, and internal link fields for validation.
  FieldStorageConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test',
    'type' => 'link',
  ])->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test',
    'bundle' => 'entity_test',
    'settings' => [
      'link_type' => LinkItemInterface::LINK_GENERIC,
    ],
  ])->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.