function GroupTest::testToDtcg

Tests toDtcg.

Attributes

#[DataProvider('providerToDtcg')]

File

core/tests/Drupal/Tests/Core/Theme/DesignToken/GroupTest.php, line 113

Class

GroupTest
Tests design token group object.

Namespace

Drupal\Tests\Core\Theme\DesignToken

Code

public function testToDtcg(?string $type, ?string $description, array $children, 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;
  $group = new DesignTokenGroup(provider: 'test', name: 'test', children: $children, description: $description, type: $type);
  $this->assertEquals($expected, $group->toDtcg());
}

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