Make WordPress Core

Opened 17 months ago

Last modified 3 weeks ago

#59791 new enhancement

Add test for get_tag_regex

Reported by: pbearne's profile pbearne Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests
Focuses: tests Cc:

Description


Change History (4)

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


17 months ago
#1

  • Keywords has-patch has-unit-tests added

#2 @desrosj
5 months ago

  • Component changed from Build/Test Tools to General
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from test for get_tag_regex to Add test for get_tag_regex
  • Type changed from defect (bug) to enhancement

Since this is about adding tests and not a general build or test tooling change, I'm reassigning it to the relevant component.

#3 @desrosj
5 weeks ago

  • Focuses tests added

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


3 weeks ago
#4

Trac Ticket: Core-59791

### Summary

This PR enhances test coverage for the get_tag_regex() function by adding additional test cases beyond the initial five. These tests ensure the function behaves correctly for a broader range of valid and malformed tag inputs.

### Why These Additional Tests?

The existing test cases covered only a few basic scenarios. The newly added cases ensure:

  • Common HTML tags: Added tests for img, br, script, div, span, table, tr, td, th, form, input, button, label, select, option, textarea, ul, ol, li, header, footer, section, article, nav, and aside to validate proper regex generation for frequently used HTML elements.
  • Malformed tags: Introduced test cases for _custom (underscore-prefixed tag) and d1v (a miswritten tag) to evaluate the function’s handling of unexpected inputs.

### Impact

These additional tests help improve the robustness of the function, ensuring it works as expected across various HTML elements and malformed inputs. This will help prevent potential regressions in future changes to get_tag_regex().

### Props

These tests are an extension of the initial test authored by @pbearne in PR.

Note: See TracTickets for help on using tickets.