function UnicodeUnitTest::testDecodeEntities

Test decode_entities().

File

modules/simpletest/tests/unicode.test, line 191

Class

UnicodeUnitTest
Test unicode handling features implemented in unicode.inc.

Code

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

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