Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 2 weeks ago

#56134 closed enhancement (fixed)

Site Health: If 0 active plugins (themes), they can't be "all up to date"

Reported by: Presskopp Owned by: SergeyBiryukov
Priority: normal Milestone: 6.1
Component: Site Health Version:
Severity: normal Keywords: has-test-info has-patch needs-testing commit has-unit-tests
Cc: Focuses:

Description

If 0 plugins are active it states:

Your site has 0 active plugins, and they are all up to date.

In my opinion we should strip the "up to date" part in that case.

Same for themes.

Attachments (1)

56134.diff​ (1.1 KB ) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (16)

#1 @SergeyBiryukov
4 years ago

  • Component Text Changes → Site Health
  • Milestone Awaiting Review → 6.1

#2 @SergeyBiryukov
4 years ago

  • Keywords has-patch added

#3 @costdev
4 years ago

  • Keywords needs-testing added

I wonder if: Your site does not have any installed themes.
might be better as: Your site does not have any themes installed.

The latter reads a little more natural to me, though it's a minor thing that I'm not precious about.

Nevermind - Just realised this would create a discrepancy with the other strings used.

The patch looks good to me! Adding needs-testing.

@Presskopp or @SergeyBiryukov, could you add some ​testing instructions and the has-testing-info keyword for the Test Team?

Last edited 4 years ago by costdev (previous) (diff)

#4 @Presskopp
4 years ago

Testing Instructions

These steps define how to test the feature or enhancement, and indicates the expected behavior or results.

Steps to Test

  1. Rename plugins folder and themes folder
  2. Open "Tools" > "Site Health"
  3. Open "Passed Tests" > "Your plugins are all up to date"
  4. Read "Your site has 0 active plugins, and they are all up to date."
  5. Open "recommended improvements"
  6. Open "Have a default theme available"
  7. Read "Your site has 0 installed themes, and they are all up to date."

Expected Results

Output:

  • ✅ Your site does not have any active plugins.
  • ✅ Your site does not have any installed themes.

#5 @Presskopp
4 years ago

  • Keywords has-testing-info added

#6 follow-up: @martin.krcho
4 years ago

  • Keywords needs-unit-tests added

@SergeyBiryukov, did you consider adding unit tests to the patch?

I can see that Tests_Site_Health tests cover only the site health check cron at the moment. Adding more specific tests will probably require considerable effort. Has this been already discussed somewhere?

#7 in reply to: ↑ 6 @SergeyBiryukov
4 years ago

Replying to martin.krcho:

@SergeyBiryukov, did you consider adding unit tests to the patch?

Thanks for bringing this up! Not really, I would for any functionality changes, but this is only a string change, so I don't think it requires unit tests.

I can see that Tests_Site_Health tests cover only the site health check cron at the moment. Adding more specific tests will probably require considerable effort. Has this been already discussed somewhere?

Yes, there's a ticket for that: #47880.

#8 @martin.krcho
4 years ago

Sounds good to me, @SergeyBiryukov. I will follow #47880 and see if I can help at some point.

#9 @Clorith
4 years ago

  • Keywords commit added

Quick and simple change, looks good to go.

#10 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 53816:

Site Health: Improve the wording in plugin and theme version tests.

This displays a more appropriate message in case the site does not have any active plugins or installed themes.

Follow-up to [44986], [45099], [45336].

Props Presskopp, costdev, martin.krcho, Clorith, SergeyBiryukov.
Fixes #56134.

#11 @SergeyBiryukov
4 years ago

In 53817:

Coding Standards: Remove extra space in two conditionals.

This fixes WPCS errors in WP_Site_Health::get_test_plugin_version() and ::get_test_theme_version():

  • Expected exactly one space between closing parenthesis and opening control structure; " " found.
  • Expected 1 space(s) after closing parenthesis; found 2

Follow-up to [53816].

See #56134.

#12 @wordpressdotorg
18 months ago

  • Keywords has-test-info added; has-testing-info removed

This ticket was mentioned in ​PR #13960 on ​WordPress/wordpress-develop by ​@irozum.


6 weeks ago
#13

  • Keywords has-unit-tests added; needs-unit-tests removed

What this covers: Adds unit tests for WP_Site_Health::get_test_plugin_version() and WP_Site_Health::get_test_theme_version(), specifically the zero-count messaging branch that [53816] / [53817] introduced for this ticket.

Why these cases: Before [53816], a site with 0 active plugins (or 0 installed themes) got the confusing "Your site has 0 active plugins, and they are all up to date." wording. The fix added a dedicated branch for the zero case ("Your site does not have any active plugins." / "...does not have any installed themes."), but neither method had any test coverage at all, so nothing guards that wording today.

  • test_get_test_plugin_version_with_no_active_plugins — sets active_plugins to an empty array and asserts the description contains the zero-plugins message.
  • test_get_test_theme_version_with_no_installed_themes — temporarily points $wp_theme_directories at an empty list (clearing the themes cache, same pattern used in Tests_Theme_ThemeDir) so wp_get_themes() returns no themes, then asserts both the good status and the zero-themes message.

Test-only change: this PR adds no production behaviour — git diff trunk touches only tests/phpunit/tests/admin/wpSiteHealth.php. Each new test was verified to fail when the corresponding message string in src/wp-admin/includes/class-wp-site-health.php is altered, then verified to pass again once reverted.

This is a follow-up to [53816] (and its coding-standards follow-up [53817]), which already fixed and closed this ticket — these tests just add the missing coverage.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Picking the ticket, reading the existing fix and surrounding code to determine the exact untested branches, writing the two test methods, and running the red/green verification loop. I reviewed the diff and test output before opening this PR.

---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request.

🤖 Generated with ​Claude Code

#14 @lancewillett
2 weeks ago

In 65103:

Tests: Cover Site Health zero-count messages.

Verify the plugin and theme checks report the intended messages when there are no active plugins or installed themes.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13960

Props irozum, huzaifaalmesbah.
See #65819, #56134.

Note: See TracTickets for help on using tickets.