function EntityResolverTest::setUp

Same name in other branches
  1. 9 core/modules/hal/tests/src/Kernel/EntityResolverTest.php \Drupal\Tests\hal\Kernel\EntityResolverTest::setUp()

Overrides NormalizerTestBase::setUp

File

core/modules/serialization/tests/src/Kernel/EntityResolverTest.php, line 31

Class

EntityResolverTest
Tests that entities references can be resolved.

Namespace

Drupal\Tests\serialization\Kernel

Code

protected function setUp() {
    parent::setUp();
    \Drupal::service('router.builder')->rebuild();
    // Create the test field storage.
    FieldStorageConfig::create([
        'entity_type' => 'entity_test_mulrev',
        'field_name' => 'field_test_entity_reference',
        'type' => 'entity_reference',
        'settings' => [
            'target_type' => 'entity_test_mulrev',
        ],
    ])->save();
    // Create the test field.
    FieldConfig::create([
        'entity_type' => 'entity_test_mulrev',
        'field_name' => 'field_test_entity_reference',
        'bundle' => 'entity_test_mulrev',
    ])->save();
}

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