function UnicodeUnitTest::testDecodeEntities in Drupal 7
Test decode_entities().
File
- modules/
simpletest/ tests/ unicode.test, line 191 - Various unicode handling tests.
Class
- UnicodeUnitTest
- Test unicode handling features implemented in unicode.inc.
Code
function testDecodeEntities() {
$testcase = array(
'Drupal' => 'Drupal',
'<script>' => '<script>',
'<script>' => '<script>',
'<script>' => '<script>',
'&lt;script&gt;' => '<script>',
'"' => '"',
'"' => '"',
'&#34;' => '"',
'"' => '"',
'&quot;' => '"',
"'" => "'",
''' => "'",
'&#39;' => ''',
'©' => '©',
'©' => '©',
'©' => '©',
'→' => '→',
'→' => '→',
'➼' => '➼',
'➼' => '➼',
'€' => '€',
);
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,
)));
}
}