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

@@ -11,7 +11,7 @@ if ( is_multisite() ) :
*/
class Tests_Multisite_User extends WP_UnitTestCase {
function test_remove_user_from_blog() {
public function test_remove_user_from_blog() {
$user1 = self::factory()->user->create_and_get();
$user2 = self::factory()->user->create_and_get();
@@ -28,7 +28,7 @@ if ( is_multisite() ) :
/**
* Test the returned data from get_blogs_of_user()
*/
function test_get_blogs_of_user() {
public function test_get_blogs_of_user() {
$user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
// Maintain a list of 6 total sites and include the primary network site.
@@ -98,7 +98,7 @@ if ( is_multisite() ) :
/**
* @expectedDeprecated is_blog_user
*/
function test_is_blog_user() {
public function test_is_blog_user() {
global $wpdb;
$user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
@@ -119,7 +119,7 @@ if ( is_multisite() ) :
wp_set_current_user( $old_current );
}
function test_is_user_member_of_blog() {
public function test_is_user_member_of_blog() {
global $wpdb;
$user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
@@ -180,7 +180,7 @@ if ( is_multisite() ) :
/**
* @ticket 23192
*/
function test_is_user_spammy() {
public function test_is_user_spammy() {
$user_id = self::factory()->user->create(
array(
'role' => 'author',
@@ -209,7 +209,7 @@ if ( is_multisite() ) :
/**
* @ticket 20601
*/
function test_user_member_of_blog() {
public function test_user_member_of_blog() {
global $wp_rewrite;
self::factory()->blog->create();
@@ -248,7 +248,7 @@ if ( is_multisite() ) :
$this->assertQueryTrue( 'is_author', 'is_archive' );
}
function test_revoked_super_admin_can_be_deleted() {
public function test_revoked_super_admin_can_be_deleted() {
if ( isset( $GLOBALS['super_admins'] ) ) {
$old_global = $GLOBALS['super_admins'];
unset( $GLOBALS['super_admins'] );
@@ -265,7 +265,7 @@ if ( is_multisite() ) :
}
}
function test_revoked_super_admin_is_deleted() {
public function test_revoked_super_admin_is_deleted() {
if ( isset( $GLOBALS['super_admins'] ) ) {
$old_global = $GLOBALS['super_admins'];
unset( $GLOBALS['super_admins'] );
@@ -284,7 +284,7 @@ if ( is_multisite() ) :
}
}
function test_super_admin_cannot_be_deleted() {
public function test_super_admin_cannot_be_deleted() {
if ( isset( $GLOBALS['super_admins'] ) ) {
$old_global = $GLOBALS['super_admins'];
unset( $GLOBALS['super_admins'] );
@@ -303,7 +303,7 @@ if ( is_multisite() ) :
/**
* @ticket 27205
*/
function test_granting_super_admins() {
public function test_granting_super_admins() {
if ( isset( $GLOBALS['super_admins'] ) ) {
$old_global = $GLOBALS['super_admins'];
unset( $GLOBALS['super_admins'] );