function DesignTokenTest::createEntity

Same name and namespace in other branches
  1. 11.x core/modules/jsonapi/tests/src/Functional/DesignTokenTest.php \Drupal\Tests\jsonapi\Functional\DesignTokenTest::createEntity()

File

core/modules/jsonapi/tests/src/Functional/DesignTokenTest.php, line 57

Class

DesignTokenTest
JSON:API integration test for the "DesignToken" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {
  // Create a design token.
  $entity = DesignToken::create([
    'id' => 'my_token',
    'path' => 'my-token',
    'type' => 'fontWeight',
    'scopes' => [
      ':root' => 500,
    ],
  ]);
  $entity->save();
  return $entity;
}

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