You are here

function UnicodeUnitTest::testDecodeEntitiesExclusion in SimpleTest 7

File

tests/unicode.test, line 188
Various unicode handling tests.

Class

UnicodeUnitTest
Test unicode handling features implemented in unicode.inc.

Code

function testDecodeEntitiesExclusion() {
  $testcase = array(
    'Drupal' => 'Drupal',
    '<script>' => '<script>',
    '&lt;script&gt;' => '&lt;script>',
    '&#60;script&#62;' => '&#60;script>',
    '&amp;lt;script&amp;gt;' => '&amp;lt;script&amp;gt;',
    '"' => '"',
    '&#34;' => '&#34;',
    '&amp;#34;' => '&amp;#34;',
    '&quot;' => '&quot;',
    '&amp;quot;' => '&amp;quot;',
    "'" => "'",
    '&#39;' => "'",
    '&amp;#39;' => '&amp;#39;',
    '©' => '©',
    '&copy;' => '©',
    '&#169;' => '©',
    '→' => '→',
    '&#8594;' => '→',
    '➼' => '➼',
    '&#10172;' => '➼',
    '&euro;' => '€',
  );
  $exclude = array(
    '<',
    '&',
    '"',
  );
  foreach ($testcase as $input => $output) {
    $this
      ->assertIdentical(decode_entities($input, $exclude), $output, t('Make sure the decoded entity of %input, excluding %excludes, is %output', array(
      '%input' => $input,
      '%excludes' => implode(',', $exclude),
      '%output' => $output,
    )));
  }
}