1 mail.test BackdropHtmlToTextTestCase::testBackdropHtmlToTextArgs()

Test $allowed_tags argument of backdrop_html_to_text().

File

core/modules/simpletest/tests/mail.test, line 227
Test the Backdrop mailing system.

Class

BackdropHtmlToTextTestCase
Unit tests for backdrop_html_to_text().

Code

function testBackdropHtmlToTextArgs() {
  // The second parameter of backdrop_html_to_text() overrules the allowed tags.
  $this->assertHtmlToText(
  'Backdrop <b>Backdrop</b> Backdrop', 
  "Backdrop *Backdrop* Backdrop\n", 
  'Allowed <b> tag found', 
  array('b')
  );
  $this->assertHtmlToText(
  'Backdrop <h1>Backdrop</h1> Backdrop', 
  "Backdrop Backdrop Backdrop\n", 
  'Disallowed <h1> tag not found', 
  array('b')
  );

  $this->assertHtmlToText(
  'Backdrop <p><em><b>Backdrop</b></em><p> Backdrop', 
  "Backdrop Backdrop Backdrop\n", 
  'Disallowed <p>, <em>, and <b> tags not found', 
  array('a', 'br', 'h1')
  );

  $this->assertHtmlToText(
  '<html><body>Backdrop</body></html>', 
  "Backdrop\n", 
  'Unsupported <html> and <body> tags not found', 
  array('html', 'body')
  );
}