function JsonApiRelationshipTest::setUp

Overrides JsonApiFunctionalTestBase::setUp

File

core/modules/jsonapi/tests/src/Functional/JsonApiRelationshipTest.php, line 49

Class

JsonApiRelationshipTest
JSON:API resource tests.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function setUp() : void {
  parent::setUp();
  EntityTestHelper::createBundle($this->bundle, 'Parent', $this->entityTypeId);
  FieldStorageConfig::create([
    'field_name' => $this->fieldName,
    'type' => 'jsonapi_test_field_type_entity_reference_uuid',
    'entity_type' => $this->entityTypeId,
    'cardinality' => 1,
    'settings' => [
      'target_type' => $this->entityTypeId,
    ],
  ])
    ->save();
  FieldConfig::create([
    'field_name' => $this->fieldName,
    'entity_type' => $this->entityTypeId,
    'bundle' => $this->bundle,
    'label' => $this->randomString(),
    'settings' => [
      'handler' => 'default',
      'handler_settings' => [],
    ],
  ])
    ->save();
  \Drupal::service('router.builder')->rebuild();
}

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