Repository navigation
Tests: Cover bloginfo() - #15320
Tests: Cover bloginfo()#15320devmuhib009 wants to merge 3 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
There was a problem hiding this comment.
🟡 Changes recommended
The tests assume fixed site titles and URLs without setting the corresponding options, causing false failures when WP_TESTS_TITLE or WP_TESTS_DOMAIN differs from the expected values.
2 open issues
What changed in this PR
Adds PHPUnit coverage for WordPress’s bloginfo() display behavior, supporting Trac ticket #65819.
Changes:
- Tests default and explicit site-name output, the home URL, and the site description.
- Verifies that the
bloginfofilter can modify the displayed site title.
| File | Description |
|---|---|
tests/phpunit/tests/general/bloginfo.php |
Adds five tests covering displayed site information and filtering. |
Review effort: Balanced
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
I left a few small notes inline.
AI Review: Opus 5.5
| * @ticket 65819 | ||
| */ | ||
| public function test_bloginfo_url() { | ||
| $this->expectOutputString( 'http://example.org' ); |
There was a problem hiding this comment.
Copilot flagged this too, and it is what fails in the two example.org:8889 jobs, where the output is http://example.org:8889. Setting the option in the test keeps the literal value and works on both:
| $this->expectOutputString( 'http://example.org' ); | |
| update_option( 'home', 'http://example.org' ); | |
| $this->expectOutputString( 'http://example.org' ); |
| * @ticket 65819 | ||
| */ | ||
| public function test_bloginfo_default_displays_name() { | ||
| $this->expectOutputString( 'Test Blog' ); |
There was a problem hiding this comment.
Optional: as Copilot noted, 'Test Blog' comes from WP_TESTS_TITLE, here and in test_bloginfo_name(). Feel free to set blogname in these tests too.
lancewillett
left a comment
There was a problem hiding this comment.
Please make the site title and home URL explicit fixtures before asserting their literal values. The new tests assume Test Blog and http://example.org, but those values come from configurable installation settings. In particular, a home URL containing :8889 is valid and cannot satisfy the current URL assertion. This confirms the existing inline feedback; no production change is needed.
AI review · gpt-6
huzaifaalmesbah
left a comment
There was a problem hiding this comment.
Thanks for the quick update, @devmuhib009! Setting explicit option fixtures (blogname, home, blogdescription) ensures deterministic assertions across all environments and addresses the review feedback cleanly. LGTM!
AI Review: Gemini 3.8 Flash
lancewillett
left a comment
There was a problem hiding this comment.
The explicit option fixtures fix the configuration-dependent failures. Please also trim two overlapping additions: remove test_bloginfo_name() and test_bloginfo_description().
Keep the default, URL, and filter cases: they protect the default selector, a non-name selector, and display-mode filtering. The explicit-name output repeats the default case, while existing Tests_Formatting_GetBloginfo checks name/description retrieval. No replacement tests are needed.
The affected classes pass randomized single-site and multisite runs (13 tests, 42 assertions each), and PHPCS passes. This remaining request is about avoiding duplicate coverage, not a failing assertion.
AI review · gpt-6
|
Updated! Removed the overlapping |
lancewillett
left a comment
There was a problem hiding this comment.
Approved at 99fe4b2. The redundant name and description cases are gone. test_bloginfo_url() now sets home itself, which fixes the example.org:8889 failure @huzaifaalmesbah raised, and the name thread no longer applies.
Exact head: 3 tests, 3 assertions in random order, single site and multisite. PHPCS clean. CI green.
AI review · claude-opus-5-5
Verify that `bloginfo()` prints the site name by default, prints the home URL for `url`, and prints the value returned by the `bloginfo` filter. Developed in: #15320 Props devmuhib, huzaifaalmesbah. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@65233 602fd350-edb4-49c9-b593-d223f7449a82
Verify that `bloginfo()` prints the site name by default, prints the home URL for `url`, and prints the value returned by the `bloginfo` filter. Developed in: WordPress/wordpress-develop#15320 Props devmuhib, huzaifaalmesbah. See #65819. Built from https://develop.svn.wordpress.org/trunk@65233 git-svn-id: http://core.svn.wordpress.org/trunk@64382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
PR #15320 landed in https://core.trac.wordpress.org/changeset/65233 |

Trac ticket: https://core.trac.wordpress.org/ticket/65819
This PR adds unit tests for
bloginfo()covering:bloginfo( 'name' )outputbloginfofilter hook