Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#65202 closed enhancement (fixed)

Tests: Add unit tests for _wp_privacy_settings_filter_draft_page_titles()

Reported by: pbearne Owned by: SergeyBiryukov
Priority: normal Milestone: 7.1
Component: Administration Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: tests

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 months ago

  • Description modified (diff)
  • Summary Tests: Add unit tests for wp_privacy_generate_personal_data_export_group_html() → 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 months 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
6 months ago

  • Milestone Awaiting Review → 7.1

#4 @SergeyBiryukov
6 months ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → 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
6 months 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.