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

@@ -8,13 +8,13 @@
*/
class Tests_Walker extends WP_UnitTestCase {
function set_up() {
public function set_up() {
parent::set_up();
$this->walker = new Walker_Test();
}
function test_single_item() {
public function test_single_item() {
$items = array(
(object) array(
@@ -29,7 +29,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_single_item_flat() {
public function test_single_item_flat() {
$items = array(
(object) array(
@@ -44,7 +44,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_single_item_depth_1() {
public function test_single_item_depth_1() {
$items = array(
(object) array(
@@ -59,7 +59,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_single_level() {
public function test_multiple_items_single_level() {
$items = array(
(object) array(
@@ -79,7 +79,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_multiple_levels() {
public function test_multiple_items_multiple_levels() {
$items = array(
(object) array(
@@ -99,7 +99,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_multiple_levels_flat() {
public function test_multiple_items_multiple_levels_flat() {
$items = array(
(object) array(
@@ -119,7 +119,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_multiple_levels_depth_1() {
public function test_multiple_items_multiple_levels_depth_1() {
$items = array(
(object) array(
@@ -139,7 +139,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_multiple_levels_depth_2() {
public function test_multiple_items_multiple_levels_depth_2() {
$items = array(
(object) array(
@@ -163,7 +163,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_recursive() {
public function test_multiple_items_recursive() {
$items = array(
(object) array(
@@ -183,7 +183,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_single_item_child() {
public function test_single_item_child() {
$items = array(
(object) array(
@@ -199,7 +199,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_single_item_missing_parent_depth_1() {
public function test_single_item_missing_parent_depth_1() {
$items = array(
(object) array(
@@ -222,7 +222,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_missing_parents() {
public function test_multiple_items_missing_parents() {
$items = array(
(object) array(
@@ -246,7 +246,7 @@ class Tests_Walker extends WP_UnitTestCase {
}
function test_multiple_items_missing_parents_depth_1() {
public function test_multiple_items_missing_parents_depth_1() {
$items = array(
(object) array(
@@ -283,7 +283,7 @@ class Tests_Walker extends WP_UnitTestCase {
/**
* @ticket 53474
*/
function test_multiple_items_non_numeric_parent() {
public function test_multiple_items_non_numeric_parent() {
$items = array(
(object) array(
@@ -320,19 +320,19 @@ class Walker_Test extends Walker {
'id' => 'id',
);
function start_lvl( &$output, $depth = 0, $args = array() ) {
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$output .= '<ul>';
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
public function end_lvl( &$output, $depth = 0, $args = array() ) {
$output .= '</ul>';
}
function start_el( &$output, $item, $depth = 0, $args = array(), $current_page = 0 ) {
public function start_el( &$output, $item, $depth = 0, $args = array(), $current_page = 0 ) {
$output .= '<li>' . $item->id;
}
function end_el( &$output, $page, $depth = 0, $args = array() ) {
public function end_el( &$output, $page, $depth = 0, $args = array() ) {
$output .= '</li>';
}