Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#65194 new enhancement

Tests: Add unit tests for update_home_siteurl()

Reported by: pbearne's profile pbearne Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch has-unit-tests
Focuses: tests Cc:

Description

This ticket adds unit tests for the update_home_siteurl() function in wp-admin/includes/misc.php. The tests will verify that rewrite rules are correctly flushed (or the rewrite_rules option is deleted in multisite) when site URLs change, while respecting the installation state.

Change History (2)

This ticket was mentioned in PR #11754 on WordPress/wordpress-develop by @pbearne.


5 weeks ago
#1

  • Keywords has-patch has-unit-tests added

Description:
This PR adds unit tests for the update_home_siteurl() function in wp-admin/includes/misc.php. These tests ensure that WordPress rewrite rules are correctly flushed (or the option is deleted in switched multisite contexts) whenever the site URL or home URL options are updated, while correctly respecting the installation state.

The tests cover:

  • Verification that rewrite rules are NOT flushed when wp_installing() is true.
  • Verification that flush_rewrite_rules() is called on single site installations.
  • Verification that flush_rewrite_rules() is called on multisite when not in a switched state.
  • Verification that the rewrite_rules option is explicitly deleted when in a switched state on multisite.

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

AI Disclosure:

  • AI assistance: Yes
  • Tool(s): Junie (JetBrains)
  • Model(s): gemini-3-flash-preview
  • Used for: Code analysis, test implementation, and workflow management.

#2 @desrosj
5 weeks ago

  • Focuses tests added

Adding the tests focus, which is used to indicate a ticket is solely focused on adding tests.

Note: See TracTickets for help on using tickets.