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
+8 -8
View File
@@ -45,7 +45,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
return $mime_type;
}
function test_is_image_positive() {
public function test_is_image_positive() {
// These are all image files recognized by PHP.
$files = array(
'test-image-cmyk.jpg',
@@ -75,7 +75,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
}
}
function test_is_image_negative() {
public function test_is_image_negative() {
// These are actually image files but aren't recognized or usable by PHP.
$files = array(
'test-image.pct',
@@ -88,7 +88,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
}
}
function test_is_displayable_image_positive() {
public function test_is_displayable_image_positive() {
// These are all usable in typical web browsers.
$files = array(
'test-image.gif',
@@ -122,7 +122,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
}
}
function test_is_displayable_image_negative() {
public function test_is_displayable_image_negative() {
// These are image files but aren't suitable for web pages because of compatibility or size issues.
$files = array(
// 'test-image-cmyk.jpg', Allowed in r9727.
@@ -147,7 +147,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
/**
* @ticket 50833
*/
function test_is_gd_image_invalid_types() {
public function test_is_gd_image_invalid_types() {
$this->assertFalse( is_gd_image( new stdClass() ) );
$this->assertFalse( is_gd_image( array() ) );
$this->assertFalse( is_gd_image( null ) );
@@ -161,7 +161,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
* @ticket 50833
* @requires extension gd
*/
function test_is_gd_image_valid_types() {
public function test_is_gd_image_valid_types() {
$this->assertTrue( is_gd_image( imagecreate( 5, 5 ) ) );
}
@@ -426,7 +426,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
$this->assertInstanceOf( 'WP_Error', $file );
}
function mock_image_editor( $editors ) {
public function mock_image_editor( $editors ) {
return array( 'WP_Image_Editor_Mock' );
}
@@ -638,7 +638,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
}
}
function filter_fallback_intermediate_image_sizes( $fallback_sizes, $metadata ) {
public function filter_fallback_intermediate_image_sizes( $fallback_sizes, $metadata ) {
// Add the 'test-size' to the list of fallback sizes.
$fallback_sizes[] = 'test-size';