function LinkFormatterDisplayTest::testNullLinkOptions
Tests that links with NULL options are rendered correctly.
File
-
core/
modules/ link/ tests/ src/ Kernel/ LinkFormatterDisplayTest.php, line 273
Class
- LinkFormatterDisplayTest
- Tests the default 'link' field formatter.
Namespace
Drupal\Tests\link\KernelCode
public function testNullLinkOptions() : void {
$entity = EntityTest::create();
$entity->field_test
->setValue([
'uri' => 'https://www.example.com',
'options' => NULL,
]);
$render_array = $entity->field_test
->view([
[
'label' => 'hidden',
'settings' => [],
],
]);
$output = (string) \Drupal::service('renderer')->renderRoot($render_array);
$this->assertStringContainsString('<div><a href="https://www.example.com">https://www.example.com</a></div>', $output);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.