diff --git a/tests/phpunit/tests/admin/includes/misc/wpPrivacySettingsFilterDraftPageTitles.php b/tests/phpunit/tests/admin/includes/misc/wpPrivacySettingsFilterDraftPageTitles.php new file mode 100644 index 0000000000000..4d0d4b1a5f20a --- /dev/null +++ b/tests/phpunit/tests/admin/includes/misc/wpPrivacySettingsFilterDraftPageTitles.php @@ -0,0 +1,72 @@ +post->create_and_get( array( 'post_status' => $post_status ) ); + + $actual = _wp_privacy_settings_filter_draft_page_titles( $title, $page ); + + $this->assertSame( $expected, $actual ); + } + + /** + * Data provider for test_wp_privacy_settings_filter_draft_page_titles. + * + * @return array + */ + public function data_wp_privacy_settings_filter_draft_page_titles(): array { + return array( + 'draft page on privacy screen' => array( + 'expected' => 'Privacy Policy (Draft)', + 'title' => 'Privacy Policy', + 'post_status' => 'draft', + 'screen_id' => 'privacy', + ), + 'publish page on privacy screen' => array( + 'expected' => 'Privacy Policy', + 'title' => 'Privacy Policy', + 'post_status' => 'publish', + 'screen_id' => 'privacy', + ), + 'draft page on other screen' => array( + 'expected' => 'About Us', + 'title' => 'About Us', + 'post_status' => 'draft', + 'screen_id' => 'edit-page', + ), + 'pending page on privacy screen' => array( + 'expected' => 'Privacy Policy', + 'title' => 'Privacy Policy', + 'post_status' => 'pending', + 'screen_id' => 'privacy', + ), + ); + } +}