You are here

public function HtmlToTextTest::testFootnoteReferences in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Mail/HtmlToTextTest.php \Drupal\system\Tests\Mail\HtmlToTextTest::testFootnoteReferences()

Test that footnote references are properly generated.

File

core/modules/system/src/Tests/Mail/HtmlToTextTest.php, line 294
Contains \Drupal\system\Tests\Mail\HtmlToTextTest.

Class

HtmlToTextTest
Tests for \Drupal\Core\Mail\MailFormatHelper::htmlToText().

Namespace

Drupal\system\Tests\Mail

Code

public function testFootnoteReferences() {
  global $base_path, $base_url;
  $source = '<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="' . $base_path . 'node/1">Path, no host</a>' . '<br /><a href="node/1">Relative path</a>';

  // @todo Footnote URLs should be absolute.
  $tt = "Host and path [1]" . "\nHost, no path [2]" . "\nPath, no host [3]" . "\nRelative path [4]" . "\n" . "\n[1] http://www.example.com/node/1" . "\n[2] http://www.example.com" . "\n[3] {$base_url}/node/1" . "\n[4] node/1\n";
  $this
    ->assertHtmlToText($source, $tt, 'Footnotes');
}