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

View File

@@ -5,7 +5,7 @@
*/
class Tests_Theme_Support extends WP_UnitTestCase {
function test_the_basics() {
public function test_the_basics() {
add_theme_support( 'automatic-feed-links' );
$this->assertTrue( current_theme_supports( 'automatic-feed-links' ) );
remove_theme_support( 'automatic-feed-links' );
@@ -14,7 +14,7 @@ class Tests_Theme_Support extends WP_UnitTestCase {
$this->assertTrue( current_theme_supports( 'automatic-feed-links' ) );
}
function test_admin_bar() {
public function test_admin_bar() {
add_theme_support( 'admin-bar' );
$this->assertTrue( current_theme_supports( 'admin-bar' ) );
remove_theme_support( 'admin-bar' );
@@ -77,7 +77,7 @@ class Tests_Theme_Support extends WP_UnitTestCase {
/**
* @ticket 24932
*/
function test_supports_html5() {
public function test_supports_html5() {
remove_theme_support( 'html5' );
$this->assertFalse( current_theme_supports( 'html5' ) );
$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
@@ -94,7 +94,7 @@ class Tests_Theme_Support extends WP_UnitTestCase {
*
* @expectedIncorrectUsage add_theme_support( 'html5' )
*/
function test_supports_html5_subset() {
public function test_supports_html5_subset() {
remove_theme_support( 'html5' );
$this->assertFalse( current_theme_supports( 'html5' ) );
$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
@@ -125,7 +125,7 @@ class Tests_Theme_Support extends WP_UnitTestCase {
*
* @expectedIncorrectUsage add_theme_support( 'html5' )
*/
function test_supports_html5_invalid() {
public function test_supports_html5_invalid() {
remove_theme_support( 'html5' );
$this->assertFalse( add_theme_support( 'html5', 'comment-form' ) );
$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
@@ -137,19 +137,19 @@ class Tests_Theme_Support extends WP_UnitTestCase {
*
* @expectedIncorrectUsage add_theme_support( 'post-formats' )
*/
function test_supports_post_formats_doing_it_wrong() {
public function test_supports_post_formats_doing_it_wrong() {
// The second parameter should be an array.
$this->assertFalse( add_theme_support( 'post-formats' ) );
}
function supports_foobar( $yesno, $args, $feature ) {
public function supports_foobar( $yesno, $args, $feature ) {
if ( $args[0] === $feature[0] ) {
return true;
}
return false;
}
function test_plugin_hook() {
public function test_plugin_hook() {
$this->assertFalse( current_theme_supports( 'foobar' ) );
add_theme_support( 'foobar' );
$this->assertTrue( current_theme_supports( 'foobar' ) );
@@ -167,7 +167,7 @@ class Tests_Theme_Support extends WP_UnitTestCase {
/**
* @ticket 26900
*/
function test_supports_menus() {
public function test_supports_menus() {
// Start fresh.
foreach ( get_registered_nav_menus() as $location => $desc ) {
unregister_nav_menu( $location );
@@ -197,7 +197,7 @@ class Tests_Theme_Support extends WP_UnitTestCase {
/**
* @ticket 45125
*/
function test_responsive_embeds() {
public function test_responsive_embeds() {
add_theme_support( 'responsive-embeds' );
$this->assertTrue( current_theme_supports( 'responsive-embeds' ) );
remove_theme_support( 'responsive-embeds' );