function GroupTest::providerToDtcg
Data provider for ::testToDtcg().
Return value
\Generator The test cases.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ DesignToken/ GroupTest.php, line 138
Class
- GroupTest
- Tests design token group object.
Namespace
Drupal\Tests\Core\Theme\DesignTokenCode
public static function providerToDtcg() : iterable {
yield 'Empty' => [
NULL,
NULL,
[],
[],
];
yield 'With type' => [
'myType',
NULL,
[],
[
'$type' => 'myType',
],
];
yield 'With description' => [
NULL,
'my description',
[],
[
'$description' => 'my description',
],
];
yield 'With children' => [
NULL,
NULL,
[
'group' => new DesignTokenGroup(provider: 'test', name: 'group', children: [
'number' => new DesignToken(provider: 'test', name: 'number', value: new Number([
'value' => 5,
], 'number', []), type: 'number'),
], description: new TranslatableMarkup('my description')),
'my-font-family' => new DesignToken(provider: 'test', name: 'my-font-family', value: new FontFamily([
'value' => 'Arial',
], 'fontFamily', []), type: 'fontFamily'),
],
[
'group' => [
'$description' => 'my description',
'number' => [
'$type' => 'number',
'$value' => 5,
],
],
'my-font-family' => [
'$type' => 'fontFamily',
'$value' => [
'Arial',
],
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.