wordpress-develop/tests/phpunit/tests/formatting/escTextarea.php
Sergey Biryukov 4d2762ed93 Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51623 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 21:33:54 +00:00

37 lines
940 B
PHP

<?php
/**
* @group formatting
*/
class Tests_Formatting_EscTextarea extends WP_UnitTestCase {
function _charset_iso_8859_1() {
return 'iso-8859-1';
}
/*
* Only fails in PHP 5.4 onwards
* @ticket 23688
*/
function test_esc_textarea_charset_iso_8859_1() {
add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
$iso8859_1 = 'Fran' . chr( 135 ) . 'ais';
$this->assertSame( $iso8859_1, esc_textarea( $iso8859_1 ) );
remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
}
function _charset_utf_8() {
return 'UTF-8';
}
/*
* @ticket 23688
*/
function test_esc_textarea_charset_utf_8() {
add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
$utf8 = 'Fran' . chr( 195 ) . chr( 167 ) . 'ais';
$this->assertSame( $utf8, esc_textarea( $utf8 ) );
remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
}
}