Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#65172 new enhancement

Tests: Add unit tests for iis7_add_rewrite_rule()

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 comprehensive unit tests for the iis7_add_rewrite_rule() function in wp-admin/includes/misc.php to ensure correct addition of WordPress rewrite rules to IIS7 web.config files, including handling of missing configuration elements.

Change History (2)

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


6 weeks ago
#1

  • Keywords has-patch has-unit-tests added

Description:
This PR adds unit tests for the iis7_add_rewrite_rule() function in wp-admin/includes/misc.php. These tests ensure that WordPress rewrite rules are correctly added to IIS7 web.config files, handling cases where configuration elements might be missing.

The tests cover:

  • Adding a rule when the file does not exist.
  • Adding a rule to an empty or partial configuration.
  • Ensuring rules are not duplicated if they already exist (case-insensitive).
  • Correct behavior with existing other rules.
  • Handling of invalid XML.

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

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.