function LinkItemSerializationTest::setUp

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

Overrides FieldKernelTestBase::setUp

File

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

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.