Make WordPress Core

Opened 6 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#65202 closed enhancement (fixed)

Tests: Add unit tests for _wp_privacy_settings_filter_draft_page_titles()

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 (last modified by pbearne)

This ticket adds unit tests for the _wp_privacy_settings_filter_draft_page_titles() function in wp-admin/includes/misc.php.

Change History (5)

#1 @pbearne
6 weeks ago

  • Description modified (diff)
  • Summary changed from Tests: Add unit tests for wp_privacy_generate_personal_data_export_group_html() to Tests: Add unit tests for _wp_privacy_settings_filter_draft_page_titles()

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


6 weeks ago
#2

  • Keywords has-patch has-unit-tests added

… wp-admin/includes/misc.php
Description:
This PR adds unit tests for the _wp_privacy_settings_filter_draft_page_titles() function in wp-admin/includes/misc.php. This function is responsible for appending "(Draft)" to the titles of draft pages when they are displayed in the privacy settings dropdown, ensuring that unpublished content is clearly identified.

The tests cover:

  • Successful appending of "(Draft)" to a draft page title on the privacy screen.
  • Verification that published page titles remain unchanged.
  • Verification that draft page titles remain unchanged when not on the privacy screen.
  • Verification that other non-draft statuses (like "pending") do not trigger the title modification.

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

AI Disclosure:

  • AI assistance: Yes
  • Tool(s): Junie (JetBrains)
  • Model(s): gemini-3-flash-preview
  • Used for: Code analysis, test implementation, and workflow management.

#3 @SergeyBiryukov
5 weeks ago

  • Milestone changed from Awaiting Review to 7.1

#4 @SergeyBiryukov
5 weeks ago

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

In 62345:

Tests: Add unit tests for _wp_privacy_settings_filter_draft_page_titles().

Follow-up to [43376].

Props pbearne.
Fixes #65202.

#5 @SergeyBiryukov
5 weeks ago

In 62346:

Coding Standards: Correct alignment in _wp_privacy_settings_filter_draft_page_titles() tests.

This resolves a WPCS warning:

Array double arrow not aligned correctly

Follow-up to [62345].

Props peterwilsoncc.
See #65202.

Note: See TracTickets for help on using tickets.