1.20.x mail.test | BackdropHtmlToTextTestCase::testHeaderSeparation() |
Test that headers are properly separated from surrounding text.
File
- modules/
simpletest/ tests/ mail.test, line 351 - Test the Backdrop mailing system.
Class
- BackdropHtmlToTextTestCase
- Unit tests for backdrop_html_to_text().
Code
function testHeaderSeparation() {
$html = 'Backdrop<h1>Backdrop</h1>Backdrop';
// @todo There should be more space above the header than below it.
$text = "Backdrop\n======== BACKDROP ============================================================\n\nBackdrop\n";
$this->assertHtmlToText($html, $text,
'Text before and after <h1> tag');
$html = '<p>Backdrop</p><h1>Backdrop</h1>Backdrop';
// @todo There should be more space above the header than below it.
$text = "Backdrop\n\n======== BACKDROP ============================================================\n\nBackdrop\n";
$this->assertHtmlToText($html, $text,
'Paragraph before and text after <h1> tag');
$html = 'Backdrop<h1>Backdrop</h1><p>Backdrop</p>';
// @todo There should be more space above the header than below it.
$text = "Backdrop\n======== BACKDROP ============================================================\n\nBackdrop\n\n";
$this->assertHtmlToText($html, $text,
'Text before and paragraph after <h1> tag');
$html = '<p>Backdrop</p><h1>Backdrop</h1><p>Backdrop</p>';
$text = "Backdrop\n\n======== BACKDROP ============================================================\n\nBackdrop\n\n";
$this->assertHtmlToText($html, $text,
'Paragraph before and after <h1> tag');
}