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

@@ -4,7 +4,7 @@
* @group taxonomy
*/
class Tests_Term_Cache extends WP_UnitTestCase {
function set_up() {
public function set_up() {
parent::set_up();
wp_cache_delete( 'last_changed', 'terms' );
@@ -13,7 +13,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 25711
*/
function test_category_children_cache() {
public function test_category_children_cache() {
// Test with only one Parent => Child.
$term_id1 = self::factory()->category->create();
$term_id1_child = self::factory()->category->create( array( 'parent' => $term_id1 ) );
@@ -38,7 +38,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 22526
*/
function test_category_name_change() {
public function test_category_name_change() {
$term = self::factory()->category->create_and_get( array( 'name' => 'Foo' ) );
$post_id = self::factory()->post->create();
wp_set_post_categories( $post_id, $term->term_id );
@@ -55,7 +55,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 14485
*/
function test_hierachy_invalidation() {
public function test_hierachy_invalidation() {
$tax = 'burrito';
register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
$this->assertTrue( get_taxonomy( $tax )->hierarchical );
@@ -241,7 +241,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 21760
*/
function test_get_term_by_slug_cache() {
public function test_get_term_by_slug_cache() {
global $wpdb;
$term_id = $this->factory->term->create(
@@ -272,7 +272,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 21760
*/
function test_get_term_by_slug_cache_update() {
public function test_get_term_by_slug_cache_update() {
global $wpdb;
$term_id = $this->factory->term->create(
@@ -310,7 +310,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 21760
*/
function test_get_term_by_name_cache() {
public function test_get_term_by_name_cache() {
global $wpdb;
$term_id = $this->factory->term->create(
@@ -339,7 +339,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 21760
*/
function test_get_term_by_name_cache_update() {
public function test_get_term_by_name_cache_update() {
global $wpdb;
$term_id = $this->factory->term->create(
@@ -374,7 +374,7 @@ class Tests_Term_Cache extends WP_UnitTestCase {
/**
* @ticket 21760
*/
function test_invalidating_term_caches_should_fail_when_invalidation_is_suspended() {
public function test_invalidating_term_caches_should_fail_when_invalidation_is_suspended() {
global $wpdb;
$term_id = $this->factory->term->create(