public function ElementTest::testProcessLegendCallable in Lightning Core 8.2
Same name and namespace in other branches
- 8.5 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendCallable()
- 8 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendCallable()
- 8.3 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendCallable()
- 8.4 tests/src/Kernel/ElementTest.php \Drupal\Tests\lightning_core\Kernel\ElementTest::testProcessLegendCallable()
@covers ::processLegend
File
- tests/
src/ Kernel/ ElementTest.php, line 68
Class
- ElementTest
- @coversDefaultClass \Drupal\lightning_core\Element
Namespace
Drupal\Tests\lightning_core\KernelCode
public function testProcessLegendCallable() {
$legend = function (array $item) {
return ucfirst($item['#label']);
};
$element = [
'foo' => [
'#type' => 'checkbox',
'#label' => 'foo',
],
'bar' => [
'#type' => 'checkbox',
'#label' => 'bar',
],
'baz' => [
'#type' => 'checkbox',
'#label' => 'baz',
],
'#legend' => $legend,
];
$element = Element::processLegend($element);
$this
->assertEquals('Foo', $element['foo']['#description']);
$this
->assertEquals('Bar', $element['bar']['#description']);
$this
->assertEquals('Baz', $element['baz']['#description']);
}