You are here

protected function EntityResolverTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/serialization/tests/src/Kernel/EntityResolverTest.php \Drupal\Tests\serialization\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();
}