Make WordPress Core

Opened 5 weeks ago

Closed 3 weeks ago

#65182 closed enhancement (fixed)

Tests: Add unit tests for wp_doc_link_parse()

Reported by: pbearne's profile pbearne Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 7.1 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 wp_doc_link_parse() function in wp-admin/includes/misc.php to ensure it correctly identifies function calls while ignoring local definitions and class methods.

Change History (4)

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


5 weeks ago
#1

  • Keywords has-patch has-unit-tests added

Description:
This PR adds unit tests for the wp_doc_link_parse() function in wp-admin/includes/misc.php. These tests ensure that the function correctly parses PHP content to identify function calls while correctly ignoring local function definitions and class method calls.

The tests cover:

  • Empty and invalid inputs.
  • Simple and multiple function calls.
  • Duplicate and sorted function names.
  • Ignoring local function definitions and object methods.
  • Correct handling of static class methods.
  • Verification of the documentation_ignore_functions filter.

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

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.

#3 @SergeyBiryukov
3 weeks ago

  • Milestone changed from Awaiting Review to 7.1

#4 @SergeyBiryukov
3 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 62369:

Tests: Add unit tests for wp_doc_link_parse().

Follow-up to [10607].

Props pbearne.
Fixes #65182.

Note: See TracTickets for help on using tickets.