You are here

protected function LinkItemSerializationTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php \Drupal\Tests\link\Kernel\LinkItemSerializationTest::setUp()
  2. 9 core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php \Drupal\Tests\link\Kernel\LinkItemSerializationTest::setUp()

File

core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php, line 34

Class

LinkItemSerializationTest
Tests link field serialization.

Namespace

Drupal\Tests\link\Kernel

Code

protected function setUp() : void {
  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();
}