function HtmlToTextTest::testDrupalHtmlToTextCollapsesWhitespace

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php \Drupal\Tests\system\Functional\Mail\HtmlToTextTest::testDrupalHtmlToTextCollapsesWhitespace()
  2. 8.9.x core/modules/system/tests/src/Functional/Mail/HtmlToTextTest.php \Drupal\Tests\system\Functional\Mail\HtmlToTextTest::testDrupalHtmltoTextCollapsesWhitespace()
  3. 10 core/modules/system/tests/src/Unit/Mail/HtmlToTextTest.php \Drupal\Tests\system\Unit\Mail\HtmlToTextTest::testDrupalHtmlToTextCollapsesWhitespace()

Tests that whitespace is collapsed.

File

core/modules/system/tests/src/Unit/Mail/HtmlToTextTest.php, line 204

Class

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

Namespace

Drupal\Tests\system\Unit\Mail

Code

public function testDrupalHtmlToTextCollapsesWhitespace() : void {
    $input = "<p>Drupal  Drupal\n\nDrupal<pre>Drupal  Drupal\n\nDrupal</pre>Drupal  Drupal\n\nDrupal</p>";
    // @todo The whitespace should be collapsed.
    $collapsed = "Drupal  Drupal\n\nDrupalDrupal  Drupal\n\nDrupalDrupal  Drupal\n\nDrupal\n\n";
    $this->assertHtmlToText($input, $collapsed, 'Whitespace is collapsed', [
        'p',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.