function DesignTokenTest::testToDtcg

Tests toDtcg.

Attributes

#[DataProvider('providerToDtcg')]

File

core/tests/Drupal/Tests/Core/Theme/DesignToken/DesignTokenTest.php, line 118

Class

DesignTokenTest
Tests design token object.

Namespace

Drupal\Tests\Core\Theme\DesignToken

Code

public function testToDtcg(?string $type, DesignTokenValueInterface $value, ?string $description, array $expected) : void {
  $container = new ContainerBuilder();
  $container->set('string_translation', $this->getStringTranslationStub());
  \Drupal::setContainer($container);
  // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString
  $description = $description ? new TranslatableMarkup($description) : NULL;
  $token = new DesignToken(provider: 'test', name: 'test', value: $value, description: $description, type: $type);
  $this->assertEquals($expected, $token->toDtcg());
}

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