Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#65194 new enhancement

Tests: Add unit tests for update_home_siteurl()

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

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.


4 months 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
4 months 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.