function DesignTokenValidationTest::setUp

File

core/tests/Drupal/KernelTests/Core/Theme/DesignToken/DesignTokenValidationTest.php, line 24

Class

DesignTokenValidationTest
Tests validation of design_token entities.

Namespace

Drupal\KernelTests\Core\Theme\DesignToken

Code

protected function setUp() : void {
  parent::setUp();
  $values = [
    'id' => 'my_id',
    'path' => 'foo.bar.baz',
    'type' => 'dimension',
    'scopes' => [
      ':root' => [
        'value' => 12,
        'unit' => 'px',
      ],
      '.card' => [
        'value' => 14,
        'unit' => 'rem',
      ],
      '%breadcrumb' => [
        'value' => 14,
        'unit' => 'rem',
      ],
    ],
  ];
  $this->entity = DesignToken::create($values);
  $this->entity
    ->save();
}

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