function TypographyTest::providerToDtcg

Data provider for ::testToDtcg().

Return value

\Generator The test cases.

File

core/tests/Drupal/Tests/Core/Theme/DesignToken/Plugin/TypographyTest.php, line 66

Class

TypographyTest
Tests typography value plugin.

Namespace

Drupal\Tests\Core\Theme\DesignToken\Plugin

Code

public static function providerToDtcg() : iterable {
  yield 'default' => [
    [
      'fontFamily' => 'Arial',
      'fontSize' => [
        'value' => 0,
        'unit' => 'px',
      ],
      'fontWeight' => 20,
      'letterSpacing' => [
        'value' => 0,
        'unit' => 'px',
      ],
      'lineHeight' => 0,
    ],
    [
      'fontFamily' => [
        'Arial',
      ],
      'fontSize' => [
        'value' => 0,
        'unit' => 'px',
      ],
      'fontWeight' => 20,
      'letterSpacing' => [
        'value' => 0,
        'unit' => 'px',
      ],
      'lineHeight' => 0,
    ],
  ];
  yield 'with enum and other structure' => [
    [
      'fontFamily' => 'Arial',
      'fontSize' => [
        'value' => 10,
        'unit' => DimensionUnit::Px,
      ],
      'fontWeight' => FontWeightAlias::Regular,
      'letterSpacing' => [
        'value' => 30,
        'unit' => dimensionUnit::Px,
      ],
      'lineHeight' => 5,
    ],
    [
      'fontFamily' => [
        'Arial',
      ],
      'fontSize' => [
        'value' => 10,
        'unit' => 'px',
      ],
      'fontWeight' => 400,
      'letterSpacing' => [
        'value' => 30,
        'unit' => 'px',
      ],
      'lineHeight' => 5,
    ],
  ];
}

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