function HtmlToTextTest::testFootnoteReferences
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php \Drupal\Tests\system\Functional\Mail\HtmlToTextTest::testFootnoteReferences()
- 10 core/modules/system/tests/src/Unit/Mail/HtmlToTextTest.php \Drupal\Tests\system\Unit\Mail\HtmlToTextTest::testFootnoteReferences()
- 11.x core/modules/system/tests/src/Unit/Mail/HtmlToTextTest.php \Drupal\Tests\system\Unit\Mail\HtmlToTextTest::testFootnoteReferences()
Test that footnote references are properly generated.
File
-
core/
modules/ system/ tests/ src/ Functional/ Mail/ HtmlToTextTest.php, line 291
Class
Namespace
Drupal\Tests\system\Functional\MailCode
public function testFootnoteReferences() {
global $base_path, $base_url;
$source = <<<EOT
<a href="http://www.example.com/node/1">Host and path</a>
<br /><a href="http://www.example.com">Host, no path</a>
<br /><a href="{<span class="php-variable">$base_path</span>}node/1">Path, no host</a>
<br /><a href="node/1">Relative path</a>
EOT;
$source = str_replace([
"\r",
"\n",
], '', $source);
// @todo Footnote URLs should be absolute.
// @todo The last two references should be combined.
$text = <<<EOT
Host and path [1]
Host, no path [2]
Path, no host [3]
Relative path [4]
[1] http://www.example.com/node/1
[2] http://www.example.com
[3] {<span class="php-variable">$base_url</span>}/node/1
[4] node/1
EOT;
$this->assertHtmlToText($source, $text, 'Footnotes');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.