/**
* Tests relative, root-relative, protocol-relative and absolute URLs.
*/
public function testUrlHandling() { // Only the plain_text text format is available by default, which escapes
// all HTML.
FilterFormat::
create([ 'format' => 'full_html',
'name' => 'Full HTML',
'filters' =>
[],
])->
save();
$defaults =
[ 'type' => 'article',
'promote' => 1,
];
/** @var \Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator */
$file_url_generator = \Drupal::
service('file_url_generator'
);
$this->
drupalCreateNode($defaults +
[ 'body' =>
[ 'value' => '<p><a href="' .
$file_url_generator->
generateString('public://root-relative'
) . '">Root-relative URL</a></p>',
'format' => 'full_html',
],