mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +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:
+12
-12
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
class Tests_URL extends WP_UnitTestCase {
|
||||
|
||||
function set_up() {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
$GLOBALS['pagenow'] = '';
|
||||
}
|
||||
@@ -15,14 +15,14 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
/**
|
||||
* @dataProvider data_is_ssl
|
||||
*/
|
||||
function test_is_ssl( $value, $expected ) {
|
||||
public function test_is_ssl( $value, $expected ) {
|
||||
$_SERVER['HTTPS'] = $value;
|
||||
|
||||
$is_ssl = is_ssl();
|
||||
$this->assertSame( $expected, $is_ssl );
|
||||
}
|
||||
|
||||
function data_is_ssl() {
|
||||
public function data_is_ssl() {
|
||||
return array(
|
||||
array(
|
||||
'on',
|
||||
@@ -47,7 +47,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
function test_is_ssl_by_port() {
|
||||
public function test_is_ssl_by_port() {
|
||||
unset( $_SERVER['HTTPS'] );
|
||||
$_SERVER['SERVER_PORT'] = '443';
|
||||
|
||||
@@ -55,7 +55,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
$this->assertTrue( $is_ssl );
|
||||
}
|
||||
|
||||
function test_is_ssl_with_no_value() {
|
||||
public function test_is_ssl_with_no_value() {
|
||||
unset( $_SERVER['HTTPS'] );
|
||||
|
||||
$is_ssl = is_ssl();
|
||||
@@ -68,7 +68,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
* @param string $url Test URL.
|
||||
* @param string $expected Expected result.
|
||||
*/
|
||||
function test_admin_url( $url, $expected ) {
|
||||
public function test_admin_url( $url, $expected ) {
|
||||
$siteurl_http = get_option( 'siteurl' );
|
||||
$admin_url_http = admin_url( $url );
|
||||
|
||||
@@ -81,7 +81,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
$this->assertSame( $siteurl_https . $expected, $admin_url_https );
|
||||
}
|
||||
|
||||
function data_admin_urls() {
|
||||
public function data_admin_urls() {
|
||||
return array(
|
||||
array(
|
||||
null,
|
||||
@@ -136,7 +136,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
* @param string $url Test URL.
|
||||
* @param string $expected Expected result.
|
||||
*/
|
||||
function test_home_url( $url, $expected ) {
|
||||
public function test_home_url( $url, $expected ) {
|
||||
$homeurl_http = get_option( 'home' );
|
||||
$home_url_http = home_url( $url );
|
||||
|
||||
@@ -149,7 +149,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
$this->assertSame( $homeurl_https . $expected, $home_url_https );
|
||||
}
|
||||
|
||||
function data_home_urls() {
|
||||
public function data_home_urls() {
|
||||
return array(
|
||||
array(
|
||||
null,
|
||||
@@ -198,7 +198,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
function test_home_url_from_admin() {
|
||||
public function test_home_url_from_admin() {
|
||||
// Pretend to be in the site admin.
|
||||
set_current_screen( 'dashboard' );
|
||||
$home = get_option( 'home' );
|
||||
@@ -243,7 +243,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
update_option( 'home', set_url_scheme( $home, 'http' ) );
|
||||
}
|
||||
|
||||
function test_network_home_url_from_admin() {
|
||||
public function test_network_home_url_from_admin() {
|
||||
// Pretend to be in the site admin.
|
||||
set_current_screen( 'dashboard' );
|
||||
$home = network_home_url();
|
||||
@@ -264,7 +264,7 @@ class Tests_URL extends WP_UnitTestCase {
|
||||
$this->assertSame( $home_https, network_home_url() );
|
||||
}
|
||||
|
||||
function test_set_url_scheme() {
|
||||
public function test_set_url_scheme() {
|
||||
$links = array(
|
||||
'http://wordpress.org/',
|
||||
'https://wordpress.org/',
|
||||
|
||||
Reference in New Issue
Block a user