Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#65178 new enhancement

Tests: Add unit tests for wp_print_theme_file_tree()

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

This ticket adds unit tests for the wp_print_theme_file_tree() function in wp-admin/includes/misc.php. This function is responsible for outputting the hierarchical file list for the theme editor.

Change History (2)

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


4 months ago
#1

  • Keywords has-patch has-unit-tests added

…sc.php
Description:
This PR adds unit tests for the wp_print_theme_file_tree() function in wp-admin/includes/misc.php. These tests ensure that the function correctly outputs the hierarchical file list for the theme editor, handling current file highlighting, aria attributes, and nested folder structures.

The tests cover:

  • Outputting a single file that is currently being edited (with appropriate classes and notice).
  • Outputting a single file that is not the current file.
  • Correct rendering of nested directory structures with appropriate labels and nesting levels.

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

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