WpHtmlEditPre.php 948 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @group formatting
  4. */
  5. class Tests_Formatting_WpHtmlEditPre extends WP_UnitTestCase {
  6. function _charset_iso_8859_1() {
  7. return 'iso-8859-1';
  8. }
  9. /*
  10. * Only fails in PHP 5.4 onwards
  11. * @ticket 23688
  12. */
  13. function test_wp_htmledit_pre_charset_iso_8859_1() {
  14. add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
  15. $iso8859_1 = 'Fran' .chr(135) .'ais';
  16. $this->assertEquals( $iso8859_1, wp_htmledit_pre( $iso8859_1 ) );
  17. remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
  18. }
  19. function _charset_utf_8() {
  20. return 'UTF-8';
  21. }
  22. /*
  23. * @ticket 23688
  24. */
  25. function test_wp_htmledit_pre_charset_utf_8() {
  26. add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
  27. $utf8 = 'Fran' .chr(195) . chr(167) .'ais';
  28. $this->assertEquals( $utf8, wp_htmledit_pre( $utf8 ) );
  29. remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
  30. }
  31. }