You are here

public function ElementTest::testProcessLegendArray in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendArray()
  2. 8 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendArray()
  3. 8.2 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendArray()
  4. 8.4 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendArray()

@covers ::processLegend

File

tests/src/Kernel/ElementTest.php, line 39

Class

ElementTest
@coversDefaultClass \Drupal\lightning_core\Element

Namespace

Drupal\Tests\lightning_core\Kernel

Code

public function testProcessLegendArray() {
  $element = [
    'foo' => [
      '#type' => 'checkbox',
    ],
    'bar' => [
      '#type' => 'checkbox',
    ],
    'baz' => [
      '#type' => 'checkbox',
    ],
    '#legend' => [
      'foo' => 'Foo',
      'bar' => 'Bar',
      'baz' => 'Baz',
      'blorf' => 'Blorf',
    ],
  ];
  $element = Element::processLegend($element);
  $this
    ->assertEquals('Foo', $element['foo']['#description']);
  $this
    ->assertEquals('Bar', $element['bar']['#description']);
  $this
    ->assertEquals('Baz', $element['baz']['#description']);
  $this
    ->assertArrayNotHasKey('blorf', $element);
}