Docs: Merge file-level and class-level DocBlocks in wp_get_canonical_url() test file.
Some checks failed
Cleanup Pull Requests / Clean up pull requests (push) Has been cancelled
Coding Standards / PHP coding standards (push) Has been cancelled
Coding Standards / JavaScript coding standards (push) Has been cancelled
Coding Standards / Slack Notifications (push) Has been cancelled
Coding Standards / Failed workflow tasks (push) Has been cancelled
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Has been cancelled
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Has been cancelled
End-to-end Tests / Slack Notifications (push) Has been cancelled
End-to-end Tests / Failed workflow tasks (push) Has been cancelled
JavaScript Tests / QUnit Tests (push) Has been cancelled
JavaScript Tests / Slack Notifications (push) Has been cancelled
JavaScript Tests / Failed workflow tasks (push) Has been cancelled
Performance Tests / Determine Matrix (push) Has been cancelled
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Has been cancelled
Performance Tests / Compare (push) Has been cancelled
Performance Tests / Slack Notifications (push) Has been cancelled
Performance Tests / Failed workflow tasks (push) Has been cancelled
PHP Compatibility / Check PHP compatibility (push) Has been cancelled
PHP Compatibility / Slack Notifications (push) Has been cancelled
PHP Compatibility / Failed workflow tasks (push) Has been cancelled
PHPUnit Tests / PHP 7.2 (push) Has been cancelled
PHPUnit Tests / PHP 7.3 (push) Has been cancelled
PHPUnit Tests / PHP 7.4 (push) Has been cancelled
PHPUnit Tests / PHP 8.0 (push) Has been cancelled
PHPUnit Tests / PHP 8.1 (push) Has been cancelled
PHPUnit Tests / PHP 8.2 (push) Has been cancelled
PHPUnit Tests / PHP 8.3 (push) Has been cancelled
PHPUnit Tests / PHP 8.4 (push) Has been cancelled
PHPUnit Tests / html-api-html5lib-tests (push) Has been cancelled
PHPUnit Tests / Slack Notifications (push) Has been cancelled
PHPUnit Tests / Failed workflow tasks (push) Has been cancelled
Test Build Processes / Core running from build (push) Has been cancelled
Test Build Processes / Core running from src (push) Has been cancelled
Test Build Processes / Gutenberg running from build (push) Has been cancelled
Test Build Processes / Gutenberg running from src (push) Has been cancelled
Test Build Processes / Slack Notifications (push) Has been cancelled
Test Build Processes / Failed workflow tasks (push) Has been cancelled

Per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#6-file-headers documentation standards], whenever possible, all WordPress files should contain a header DocBlock, regardless of the file’s contents – this includes files containing classes.

However, this recommendation makes less sense for unit test classes if not applied consistently, and the duplicate tags cause some confusion.

This commit aims to reduce confusion and avoid repeating information by combining the DocBlocks.

Includes using third-person singular verbs in test method descriptions, as per the documentation standards.

Follow-up to [55337], [60108], [60109].

See #63166.

git-svn-id: https://develop.svn.wordpress.org/trunk@60112 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2025-03-31 21:21:05 +00:00
parent d52e9453ed
commit 3998c85e88

View File

@ -2,18 +2,12 @@
/**
* Tests for the wp_get_canonical_url() function.
*
* @package WordPress
* @subpackage Link
*/
/**
* Class for Testing the wp_get_canonical_url() function.
*
* @group link
* @group canonical
* @covers ::wp_get_canonical_url
*/
class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
/**
* The ID of the post.
*
@ -51,14 +45,14 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* Test for a non existing post.
* Tests that false is returned for a non-existing post.
*/
public function test_non_existing_post() {
$this->assertFalse( wp_get_canonical_url( -1 ) );
}
/**
* Test for a post that is not published.
* Tests that false is returned for a post that is not published.
*/
public function test_post_status() {
$post_id = self::factory()->post->create(
@ -71,14 +65,14 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* Test for a page that is not the queried object.
* Tests canonical URL for a page that is not the queried object.
*/
public function test_non_current_page() {
$this->assertSame( get_permalink( self::$post_id ), wp_get_canonical_url( self::$post_id ) );
}
/**
* Test non permalink structure page usage.
* Tests non-permalink structure page usage.
*/
public function test_paged_with_plain_permalink_structure() {
$link = add_query_arg(
@ -102,7 +96,7 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* Test permalink structure page usage.
* Tests permalink structure page usage.
*/
public function test_paged_with_custom_permalink_structure() {
$this->set_permalink_structure( '/%postname%/' );
@ -124,7 +118,7 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* Test non permalink structure comment page usage.
* Tests non-permalink structure comment page usage.
*/
public function test_comments_paged_with_plain_permalink_structure() {
$cpage = 2;
@ -150,7 +144,7 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* Test permalink structure comment page usage.
* Tests permalink structure comment page usage.
*/
public function test_comments_paged_with_pretty_permalink_structure() {
global $wp_rewrite;
@ -174,7 +168,7 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* This test ensures that attachments with 'inherit' status properly receive a canonical URL.
* Tests that attachments with 'inherit' status properly receive a canonical URL.
*
* @ticket 63041
*/
@ -187,7 +181,7 @@ class Tests_Link_WpGetCanonicalUrl extends WP_UnitTestCase {
}
/**
* Test calling of filter.
* Tests calling of filter.
*/
public function test_get_canonical_url_filter() {
add_filter( 'get_canonical_url', array( $this, 'canonical_url_filter' ) );