function FieldItemTest::testGetLabel
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php \Drupal\KernelTests\Core\Field\FieldItemTest::testGetLabel()
Tests \Drupal\Core\Field\TypedData\FieldItemDataDefinition::getLabel().
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Field/ FieldItemTest.php, line 107
Class
- FieldItemTest
- Test field item methods.
Namespace
Drupal\KernelTests\Core\FieldCode
public function testGetLabel() : void {
$data_definition = \Drupal::service('typed_data_manager')->createDataDefinition('field_item:string');
$this->assertEquals('Text (plain)', $data_definition->getLabel());
$label = 'Foo bar';
$data_definition->setLabel($label);
$this->assertEquals($label, $data_definition->getLabel());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.