Skip to content

Tests: Add unit tests for Plugin_Upgrader_Skin - #15713

Closed
hmbashar wants to merge 1 commit into
WordPress:trunkfrom
hmbashar:66551-plugin-upgrader-skin-tests
Closed

hmbashar wants to merge 1 commit into
WordPress:trunkfrom
hmbashar:66551-plugin-upgrader-skin-tests

Conversation

@hmbashar

@hmbashar hmbashar commented Nov 6, 2026

Copy link
Copy Markdown

Summary

Adds tests for Plugin_Upgrader_Skin, which had no coverage (0% on Codecov).

  • The constructor uses the defaults and the arguments, and detects an active plugin and a network active plugin.
  • after() activates an active plugin again in a frame, but not an inactive plugin, a failed update or an update without an installed plugin.
  • after() links to activate the plugin and to the Plugins page, and leaves out the link to activate it after a failure or for a user who cannot activate plugins.
  • The update_plugin_complete_actions filter receives the links and the plugin file, and no feedback is given when the links are removed.
  • The update count is decremented after a successful update only.

Testing

vendor/bin/phpunit --filter 'Tests_Admin_PluginUpgraderSkin::'
vendor/bin/phpunit -c tests/phpunit/multisite.xml --filter 'Tests_Admin_PluginUpgraderSkin::'
vendor/bin/phpcs tests/phpunit/tests/admin/pluginUpgraderSkin.php

Mutation check: 18 changes to class-plugin-upgrader-skin.php (the conditions of the frame and of the links, the filter, the separator, the nonce, the update count) were each caught by a test. The change to the network active check is caught by the multisite run only.

The skin collects its feedback in the test, because show_message() ends all output buffers.

Trac ticket: https://core.trac.wordpress.org/ticket/66551

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Written with AI and manually reviewed by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@hmbashar
hmbashar marked this pull request as ready for review November 6, 2026 14:04
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

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:

Props hmbashar.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@hmbashar hmbashar closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant