Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#65148 new enhancement

Unit Tests: Add tests for iis7_rewrite_rule_exists()

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

The function iis7_rewrite_rule_exists() in src/wp-admin/includes/misc.php lacks unit tests. This ticket covers adding tests to ensure it correctly detects the presence of WordPress rewrite rules within an IIS web.config file using XPath.

Change History (2)

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


4 months ago
#1

  • Keywords has-patch has-unit-tests added

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

The tests cover:

  • Detection of rewrite rules with names "wordpress" and "WordPress".
  • Detection of rules with names starting with "wordpress".
  • Correct handling of files where the rule does not exist.
  • Handling of empty XML configuration and invalid XML content.
  • Handling of non-existent files (returns false).

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

## Use of AI Tools
AI assistance: Yes
Tool(s): Junie (JetBrains)
Model(s): gemini-3-flash-preview
Used for: Test structure generation, dataProvider implementation, and local environment verification. All tests were verified against WordPress core standards and run in the local Docker environment.

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