function ManageFieldsFunctionalTest::testHelpDescriptions
Same name in other branches
- 9 core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testHelpDescriptions()
- 8.9.x core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testHelpDescriptions()
- 11.x core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php \Drupal\Tests\field_ui\Functional\ManageFieldsFunctionalTest::testHelpDescriptions()
Tests that help descriptions render valid HTML.
File
-
core/
modules/ field_ui/ tests/ src/ Functional/ ManageFieldsFunctionalTest.php, line 284
Class
- ManageFieldsFunctionalTest
- Tests the Field UI "Manage fields" screen.
Namespace
Drupal\Tests\field_ui\FunctionalCode
public function testHelpDescriptions() : void {
// Create an image field.
FieldStorageConfig::create([
'field_name' => 'field_image',
'entity_type' => 'node',
'type' => 'image',
])->save();
FieldConfig::create([
'field_name' => 'field_image',
'entity_type' => 'node',
'label' => 'Image',
'bundle' => 'article',
])->save();
\Drupal::service('entity_display.repository')->getFormDisplay('node', 'article')
->setComponent('field_image')
->save();
$edit = [
'description' => '<strong>Test with an upload field.',
];
$this->drupalGet('admin/structure/types/manage/article/fields/node.article.field_image');
$this->submitForm($edit, 'Save settings');
// Check that hook_field_widget_single_element_form_alter() does believe
// this is the default value form.
$this->drupalGet('admin/structure/types/manage/article/fields/node.article.field_tags');
$this->assertSession()
->pageTextContains('From hook_field_widget_single_element_form_alter(): Default form is true.');
$edit = [
'description' => '<em>Test with a non upload field.',
];
$this->drupalGet('admin/structure/types/manage/article/fields/node.article.field_tags');
$this->submitForm($edit, 'Save settings');
$this->drupalGet('node/add/article');
$this->assertSession()
->responseContains('<strong>Test with an upload field.</strong>');
$this->assertSession()
->responseContains('<em>Test with a non upload field.</em>');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.