diff --git a/tests/phpunit/tests/url.php b/tests/phpunit/tests/url.php index ff360fdea4..a5871ecdc7 100644 --- a/tests/phpunit/tests/url.php +++ b/tests/phpunit/tests/url.php @@ -14,6 +14,8 @@ class Tests_URL extends WP_UnitTestCase { /** * @dataProvider data_is_ssl + * + * @covers ::is_ssl */ public function test_is_ssl( $value, $expected ) { $_SERVER['HTTPS'] = $value; @@ -47,6 +49,9 @@ class Tests_URL extends WP_UnitTestCase { ); } + /** + * @covers ::is_ssl + */ public function test_is_ssl_by_port() { unset( $_SERVER['HTTPS'] ); $_SERVER['SERVER_PORT'] = '443'; @@ -55,6 +60,9 @@ class Tests_URL extends WP_UnitTestCase { $this->assertTrue( $is_ssl ); } + /** + * @covers ::is_ssl + */ public function test_is_ssl_with_no_value() { unset( $_SERVER['HTTPS'] ); @@ -67,6 +75,8 @@ class Tests_URL extends WP_UnitTestCase { * * @param string $url Test URL. * @param string $expected Expected result. + * + * @covers ::admin_url */ public function test_admin_url( $url, $expected ) { $siteurl_http = get_option( 'siteurl' ); @@ -135,6 +145,8 @@ class Tests_URL extends WP_UnitTestCase { * * @param string $url Test URL. * @param string $expected Expected result. + * + * @covers ::home_url */ public function test_home_url( $url, $expected ) { $homeurl_http = get_option( 'home' ); @@ -198,6 +210,11 @@ class Tests_URL extends WP_UnitTestCase { ); } + /** + * @covers ::home_url + * + * @uses ::get_option + */ public function test_home_url_from_admin() { // Pretend to be in the site admin. set_current_screen( 'dashboard' ); @@ -243,6 +260,9 @@ class Tests_URL extends WP_UnitTestCase { update_option( 'home', set_url_scheme( $home, 'http' ) ); } + /** + * @covers ::network_home_url + */ public function test_network_home_url_from_admin() { // Pretend to be in the site admin. set_current_screen( 'dashboard' ); @@ -264,6 +284,9 @@ class Tests_URL extends WP_UnitTestCase { $this->assertSame( $home_https, network_home_url() ); } + /** + * @covers ::set_url_scheme + */ public function test_set_url_scheme() { $links = array( 'http://wordpress.org/', @@ -324,6 +347,9 @@ class Tests_URL extends WP_UnitTestCase { force_ssl_admin( $forced_admin ); } + /** + * @covers ::get_adjacent_post + */ public function test_get_adjacent_post() { $now = time(); $post_id = self::factory()->post->create( array( 'post_date' => gmdate( 'Y-m-d H:i:s', $now - 1 ) ) ); @@ -358,6 +384,8 @@ class Tests_URL extends WP_UnitTestCase { * Test get_adjacent_post returns the next private post when the author is the currently logged in user. * * @ticket 30287 + * + * @covers ::get_adjacent_post */ public function test_get_adjacent_post_should_return_private_posts_belonging_to_the_current_user() { $u = self::factory()->user->create( array( 'role' => 'author' ) ); @@ -395,6 +423,8 @@ class Tests_URL extends WP_UnitTestCase { /** * @ticket 30287 + * + * @covers ::get_adjacent_post */ public function test_get_adjacent_post_should_return_private_posts_belonging_to_other_users_if_the_current_user_can_read_private_posts() { $u1 = self::factory()->user->create( array( 'role' => 'author' ) ); @@ -433,6 +463,8 @@ class Tests_URL extends WP_UnitTestCase { /** * @ticket 30287 + * + * @covers ::get_adjacent_post */ public function test_get_adjacent_post_should_not_return_private_posts_belonging_to_other_users_if_the_current_user_cannot_read_private_posts() { $u1 = self::factory()->user->create( array( 'role' => 'author' ) ); @@ -479,6 +511,17 @@ class Tests_URL extends WP_UnitTestCase { * Test that *_url functions handle paths with ".." * * @ticket 19032 + * + * @covers ::site_url + * @covers ::home_url + * @covers ::admin_url + * @covers ::network_admin_url + * @covers ::user_admin_url + * @covers ::includes_url + * @covers ::network_site_url + * @covers ::network_home_url + * @covers ::content_url + * @covers ::plugins_url */ public function test_url_functions_for_dots_in_paths() { $functions = array( diff --git a/tests/phpunit/tests/url/getPrivacyPolicyUrl.php b/tests/phpunit/tests/url/getPrivacyPolicyUrl.php index 5c46b9bfe1..6518cd064f 100644 --- a/tests/phpunit/tests/url/getPrivacyPolicyUrl.php +++ b/tests/phpunit/tests/url/getPrivacyPolicyUrl.php @@ -12,9 +12,10 @@ * * @group url * @group privacy - * @covers ::get_privacy_policy_url * * @since 4.9.6 + * + * @covers ::get_privacy_policy_url */ class Tests_Url_GetPrivacyPolicyUrl extends WP_UnitTestCase { /** @@ -56,6 +57,8 @@ class Tests_Url_GetPrivacyPolicyUrl extends WP_UnitTestCase { /** * The function should return the privacy policy URL when `wp_page_for_privacy_policy` is set. + * + * @uses ::get_permalink */ public function test_get_privacy_policy_url_should_return_valid_url_when_policy_page_set() { $privacy_policy_url = get_permalink( self::$privacy_policy_page_id );