Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a `private` visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a `_` prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

git-svn-id: https://develop.svn.wordpress.org/trunk@52010 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork
2021-11-04 15:22:47 +00:00
parent 80380cd374
commit 40ac5de838
327 changed files with 3656 additions and 3969 deletions
@@ -5,7 +5,7 @@
*/
class Tests_Formatting_EscTextarea extends WP_UnitTestCase {
function _charset_iso_8859_1() {
public function charset_iso_8859_1() {
return 'iso-8859-1';
}
@@ -13,24 +13,24 @@ class Tests_Formatting_EscTextarea extends WP_UnitTestCase {
* 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' ) );
public 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' ) );
remove_filter( 'pre_option_blog_charset', array( $this, 'charset_iso_8859_1' ) );
}
function _charset_utf_8() {
public 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' ) );
public 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' ) );
remove_filter( 'pre_option_blog_charset', array( $this, 'charset_utf_8' ) );
}
}