mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -7,19 +7,19 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
|
||||
public $siteurl;
|
||||
|
||||
function set_up() {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
$this->_reset_options();
|
||||
$this->reset_options();
|
||||
}
|
||||
|
||||
function _reset_options() {
|
||||
private function reset_options() {
|
||||
// System defaults.
|
||||
update_option( 'upload_path', 'wp-content/uploads' );
|
||||
update_option( 'upload_url_path', '' );
|
||||
update_option( 'uploads_use_yearmonth_folders', 1 );
|
||||
}
|
||||
|
||||
function test_upload_dir_default() {
|
||||
public function test_upload_dir_default() {
|
||||
// wp_upload_dir() with default parameters.
|
||||
$info = wp_upload_dir();
|
||||
$subdir = date_format( date_create( 'now' ), '/Y/m' );
|
||||
@@ -30,7 +30,7 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
$this->assertFalse( $info['error'] );
|
||||
}
|
||||
|
||||
function test_upload_dir_relative() {
|
||||
public function test_upload_dir_relative() {
|
||||
// wp_upload_dir() with a relative upload path that is not 'wp-content/uploads'.
|
||||
update_option( 'upload_path', 'foo/bar' );
|
||||
$info = _wp_upload_dir();
|
||||
@@ -45,7 +45,7 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 5953
|
||||
*/
|
||||
function test_upload_dir_absolute() {
|
||||
public function test_upload_dir_absolute() {
|
||||
$path = get_temp_dir() . 'wp-unit-test';
|
||||
|
||||
// wp_upload_dir() with an absolute upload path.
|
||||
@@ -65,7 +65,7 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
$this->assertFalse( $info['error'] );
|
||||
}
|
||||
|
||||
function test_upload_dir_no_yearnum() {
|
||||
public function test_upload_dir_no_yearnum() {
|
||||
update_option( 'uploads_use_yearmonth_folders', 0 );
|
||||
|
||||
// Use `_wp_upload_dir()` directly to bypass caching and work with the changed options.
|
||||
@@ -77,7 +77,7 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
$this->assertFalse( $info['error'] );
|
||||
}
|
||||
|
||||
function test_upload_path_absolute() {
|
||||
public function test_upload_path_absolute() {
|
||||
update_option( 'upload_url_path', 'http://' . WP_TESTS_DOMAIN . '/asdf' );
|
||||
|
||||
// Use `_wp_upload_dir()` directly to bypass caching and work with the changed options.
|
||||
@@ -91,7 +91,7 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
$this->assertFalse( $info['error'] );
|
||||
}
|
||||
|
||||
function test_upload_dir_empty() {
|
||||
public function test_upload_dir_empty() {
|
||||
// Upload path setting is empty - it should default to 'wp-content/uploads'.
|
||||
update_option( 'upload_path', '' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user