Make WordPress Core


Ignore:
Timestamp:
08/18/2024 11:43:37 PM (7 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Bring some consistency to personal data email notification tests.

Includes:

  • Adding a test for wp_privacy_send_personal_data_export_email() to verify the user_request post type.
  • Reordering some pre-existing tests to check the request ID and post type first.

Follow-up to [43291], [43499], [44535].

Props garrett-eclipse, berubenic.
See #46560.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php

    r56547 r58912  
    3333
    3434    /**
    35      * The function should not send emails when the request ID does not exist.
    36      *
    37      * @ticket 43967
    38      */
    39     public function test_function_should_not_send_email_when_not_a_valid_request_id() {
     35     * The function should not send an email when the request ID does not exist.
     36     *
     37     * @ticket 43967
     38     */
     39    public function test_should_not_send_email_when_not_a_valid_request_id() {
    4040        _wp_privacy_send_request_confirmation_notification( 1234567890 );
    4141        $mailer = tests_retrieve_phpmailer_instance();
     
    4545
    4646    /**
    47      * The function should not send emails when the ID passed is not a WP_User_Request.
    48      *
    49      * @ticket 43967
    50      */
    51     public function test_function_should_not_send_email_when_not_a_wp_user_request() {
     47     * The function should not send an email when the ID passed does not correspond to a user request.
     48     *
     49     * @ticket 43967
     50     */
     51    public function test_should_not_send_email_when_not_a_user_request() {
    5252        $post_id = self::factory()->post->create(
    5353            array(
    54                 'post_type' => 'post',
     54                'post_type' => 'post', // Should be 'user_request'.
    5555            )
    5656        );
     
    6767     * @ticket 43967
    6868     */
    69     public function test_function_should_send_email_to_site_admin_when_user_request_confirmed() {
     69    public function test_should_send_email_to_site_admin_when_user_request_confirmed() {
    7070        $email      = 'export.request.from.unregistered.user@example.com';
    7171        $request_id = wp_create_user_request( $email, 'export_personal_data' );
     
    9090     * @ticket 43967
    9191     */
    92     public function test_function_should_only_send_email_to_site_admin_when_user_request_is_confirmed() {
     92    public function test_should_only_send_email_to_site_admin_when_user_request_is_confirmed() {
    9393        $email      = 'export.request.from.unregistered.user@example.com';
    9494        $request_id = wp_create_user_request( $email, 'export_personal_data' );
     
    110110     * @ticket 43967
    111111     */
    112     public function test_function_should_only_send_email_once_to_admin_when_user_request_is_confirmed() {
     112    public function test_should_only_send_email_once_to_admin_when_user_request_is_confirmed() {
    113113        $email      = 'export.request.from.unregistered.user@example.com';
    114114        $request_id = wp_create_user_request( $email, 'export_personal_data' );
Note: See TracChangeset for help on using the changeset viewer.