Make WordPress Core

Opened 7 weeks ago

Last modified 5 weeks ago

#65147 new enhancement

Unit Tests: Add tests for iis7_save_url_rewrite_rules()

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

The function iis7_save_url_rewrite_rules() in src/wp-admin/includes/misc.php currently lacks unit tests. This ticket covers the addition of tests to ensure it correctly manages the web.config file on IIS7+ servers, handles multisite status, and correctly adds or deletes rules based on the current permalink structure.

Change History (2)

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


7 weeks ago
#1

  • Keywords has-patch has-unit-tests added

…udes/misc.php
This PR adds comprehensive unit tests for the iis7_save_url_rewrite_rules() function in src/wp-admin/includes/misc.php.

The tests cover:

  • Successful creation and update of the web.config file on IIS7+ servers.
  • Logic for adding rewrite rules when permalinks are enabled.
  • Logic for deleting rewrite rules when permalinks are disabled.
  • Handling of multisite status (returns null).
  • Environmental mocking for $is_iis7 and iis7_supports_permalinks().

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

## Use of AI Tools
AI assistance: Yes
Tool(s): Junie (JetBrains)
Model(s): gemini-3-flash-preview
Used for: Identifying edge cases, implementing temporary directory cleanup, and mocking environmental dependencies. All code follows WordPress Coding Standards.

#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.