Make WordPress Core

Opened 6 weeks ago

Closed 4 weeks ago

#65175 closed enhancement (fixed)

Tests: Add unit tests for wp_make_theme_file_tree()

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 unit tests for the wp_make_theme_file_tree() function in wp-admin/includes/misc.php. This function is responsible for converting a flat list of theme files into a tree structure for use in the theme editor.

Change History (4)

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


6 weeks ago
#1

  • Keywords has-patch has-unit-tests added

…c.php

Description:
This PR adds unit tests for the wp_make_theme_file_tree() function in wp-admin/includes/misc.php. These tests ensure that the function correctly converts a flat list of theme file paths into a hierarchical tree structure, which is used for the file list in the theme editor.

The tests cover:

  • Empty input list.
  • Flat list of files (no directories).
  • Nested list with single-level directories.
  • Deeply nested directories.
  • Mixed nesting levels.

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

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
4 weeks ago

  • Milestone changed from Awaiting Review to 7.1

#4 @SergeyBiryukov
4 weeks ago

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

In 62388:

Tests: Add unit tests for wp_make_theme_file_tree().

Follow-up to [41851].

Props pbearne.
Fixes #65175.

Note: See TracTickets for help on using tickets.