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

@@ -1284,7 +1284,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
$this->assertSame( array( $comments[2] ), $q->comments );
}
function test_get_comments_for_post() {
public function test_get_comments_for_post() {
$limit = 5;
$post_id = self::factory()->post->create();
@@ -1344,7 +1344,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 21003
*/
function test_orderby_meta() {
public function test_orderby_meta() {
$comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
$comment_id2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
$comment_id3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
@@ -1596,7 +1596,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 27064
*/
function test_get_comments_by_user() {
public function test_get_comments_by_user() {
$users = self::factory()->user->create_many( 2 );
self::factory()->comment->create(
array(
@@ -1689,7 +1689,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 28434
*/
function test_fields_ids_query() {
public function test_fields_ids_query() {
$comment_1 = self::factory()->comment->create(
array(
'comment_post_ID' => self::$post_id,
@@ -1725,7 +1725,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29189
*/
function test_fields_comment__in() {
public function test_fields_comment__in() {
$comment_1 = self::factory()->comment->create(
array(
'comment_post_ID' => self::$post_id,
@@ -1761,7 +1761,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29189
*/
function test_fields_comment__not_in() {
public function test_fields_comment__not_in() {
$comment_1 = self::factory()->comment->create(
array(
'comment_post_ID' => self::$post_id,
@@ -1797,7 +1797,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29189
*/
function test_fields_post__in() {
public function test_fields_post__in() {
$p1 = self::factory()->post->create();
$p2 = self::factory()->post->create();
$p3 = self::factory()->post->create();
@@ -1837,7 +1837,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29189
*/
function test_fields_post__not_in() {
public function test_fields_post__not_in() {
$p1 = self::factory()->post->create();
$p2 = self::factory()->post->create();
$p3 = self::factory()->post->create();
@@ -1877,7 +1877,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29885
*/
function test_fields_post_author__in() {
public function test_fields_post_author__in() {
$author_id1 = 105;
$author_id2 = 106;
@@ -1920,7 +1920,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29885
*/
function test_fields_post_author__not_in() {
public function test_fields_post_author__not_in() {
$author_id1 = 111;
$author_id2 = 112;
@@ -1963,7 +1963,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29885
*/
function test_fields_author__in() {
public function test_fields_author__in() {
$p1 = self::factory()->post->create();
$p2 = self::factory()->post->create();
$p3 = self::factory()->post->create();
@@ -2011,7 +2011,7 @@ class Tests_Comment_Query extends WP_UnitTestCase {
/**
* @ticket 29885
*/
function test_fields_author__not_in() {
public function test_fields_author__not_in() {
$p1 = self::factory()->post->create();
$p2 = self::factory()->post->create();
$p3 = self::factory()->post->create();