WpHtmlEditPre.php 993 B

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