function DesignTokenValuePluginManagerKernelTest::testDetectedPlugins

Tests detected plugins provided by Core.

File

core/tests/Drupal/KernelTests/Core/Theme/DesignToken/DesignTokenValuePluginManagerKernelTest.php, line 46

Class

DesignTokenValuePluginManagerKernelTest
Tests the design token value plugin manager.

Namespace

Drupal\KernelTests\Core\Theme\DesignToken

Code

public function testDetectedPlugins() : void {
  $definitions = $this->designTokenValuePluginManager
    ->getDefinitions();
  $expected = [
    'dimension' => [
      'class' => Dimension::class,
      'provider' => 'core',
      'id' => 'dimension',
      'label' => new TranslatableMarkup('Dimension'),
    ],
    'fontFamily' => [
      'class' => FontFamily::class,
      'provider' => 'core',
      'id' => 'fontFamily',
      'label' => new TranslatableMarkup('Font family'),
    ],
    'fontWeight' => [
      'class' => FontWeight::class,
      'provider' => 'core',
      'id' => 'fontWeight',
      'label' => new TranslatableMarkup('Font weight'),
    ],
    'number' => [
      'class' => Number::class,
      'provider' => 'core',
      'id' => 'number',
      'label' => new TranslatableMarkup('Number'),
    ],
    'typography' => [
      'class' => Typography::class,
      'provider' => 'core',
      'id' => 'typography',
      'label' => new TranslatableMarkup('Typography'),
    ],
  ];
  foreach ($expected as $id => $infos) {
    $this->assertArrayHasKey($id, $definitions);
    foreach ($infos as $key => $expectedValue) {
      $this->assertEquals($expectedValue, $definitions[$id][$key]);
    }
  }
}

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