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
+10 -10
View File
@@ -8,7 +8,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
/**
* Set up.
*/
function set_up() {
public function set_up() {
parent::set_up();
// Unregister all nav menu locations.
@@ -22,7 +22,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @param array $locations Location slugs.
*/
function register_nav_menu_locations( $locations ) {
private function register_nav_menu_locations( $locations ) {
foreach ( $locations as $location ) {
register_nav_menu( $location, ucfirst( $location ) );
}
@@ -33,7 +33,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_one_location_each() {
public function test_one_location_each() {
$this->register_nav_menu_locations( array( 'primary' ) );
$prev_theme_nav_menu_locations = array(
'unique-slug' => 1,
@@ -52,7 +52,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_filter_registered_locations() {
public function test_filter_registered_locations() {
$this->register_nav_menu_locations( array( 'primary', 'secondary' ) );
$prev_theme_nav_menu_locations = array(
'primary' => 1,
@@ -74,7 +74,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_locations_with_same_slug() {
public function test_locations_with_same_slug() {
$this->register_nav_menu_locations( array( 'primary', 'secondary' ) );
$prev_theme_nav_menu_locations = array(
'primary' => 1,
@@ -93,7 +93,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_new_theme_previously_active() {
public function test_new_theme_previously_active() {
$this->register_nav_menu_locations( array( 'primary' ) );
$prev_theme_nav_menu_locations = array(
@@ -117,7 +117,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_location_guessing() {
public function test_location_guessing() {
$this->register_nav_menu_locations( array( 'primary', 'secondary' ) );
$prev_theme_nav_menu_locations = array(
@@ -140,7 +140,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_location_guessing_one_menu_per_group() {
public function test_location_guessing_one_menu_per_group() {
$this->register_nav_menu_locations( array( 'primary' ) );
$prev_theme_nav_menu_locations = array(
'top-menu' => 1,
@@ -161,7 +161,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_location_guessing_one_menu_per_location() {
public function test_location_guessing_one_menu_per_location() {
$this->register_nav_menu_locations( array( 'primary', 'main' ) );
$prev_theme_nav_menu_locations = array(
@@ -186,7 +186,7 @@ class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase {
*
* @covers ::wp_map_nav_menu_locations
*/
function test_numerical_locations() {
public function test_numerical_locations() {
$this->register_nav_menu_locations( array( 'primary', 1 ) );
$prev_theme_nav_menu_locations = array(
@@ -7,7 +7,7 @@
class Tests_Menu_Walker_Nav_Menu_Edit extends WP_UnitTestCase {
protected $_wp_nav_menu_max_depth;
function set_up() {
public function set_up() {
global $_wp_nav_menu_max_depth;
parent::set_up();
@@ -20,7 +20,7 @@ class Tests_Menu_Walker_Nav_Menu_Edit extends WP_UnitTestCase {
$this->_wp_nav_menu_max_depth = $_wp_nav_menu_max_depth;
}
function tear_down() {
public function tear_down() {
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = $this->_wp_nav_menu_max_depth;
@@ -31,7 +31,7 @@ class Tests_Menu_Walker_Nav_Menu_Edit extends WP_UnitTestCase {
/**
* @ticket 36729
*/
function test_original_title_prefix_should_not_be_shown_if_empty() {
public function test_original_title_prefix_should_not_be_shown_if_empty() {
$expected = '';
$post_id = $this->factory->post->create();