Make WordPress Core


Ignore:
Timestamp:
02/13/2023 10:03:30 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Comments: Use correct orderby parameter name in personal data exporter and eraser.

This ensures that get_comments() is called with the correct parameter name in:

  • wp_comments_personal_data_exporter()
  • wp_comments_personal_data_eraser()

Follow-up to [42888], [42994].

Props smeunus, kapilpaul, SergeyBiryukov.
Fixes #57700.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/wpCommentsPersonalDataEraser.php

    r55322 r55324  
    230230        return sprintf( 'Some custom message for comment %d.', $comment->comment_ID );
    231231    }
     232
     233    /**
     234     * Testing that `wp_comments_personal_data_eraser()` orders comments by ID.
     235     *
     236     * @ticket 57700
     237     */
     238    public function test_wp_comments_personal_data_eraser_orders_comments_by_id() {
     239
     240        $args = array(
     241            'comment_post_ID'      => self::$post_id,
     242            'comment_author'       => 'Comment Author',
     243            'comment_author_email' => 'personal@local.host',
     244            'comment_author_url'   => 'https://local.host/',
     245            'comment_author_IP'    => '192.168.0.1',
     246            'comment_date'         => '2018-04-14 17:20:00',
     247            'comment_agent'        => 'COMMENT_AGENT',
     248            'comment_content'      => 'Comment Content',
     249        );
     250        self::factory()->comment->create( $args );
     251
     252        $filter = new MockAction();
     253        add_filter( 'comments_clauses', array( &$filter, 'filter' ) );
     254
     255        wp_comments_personal_data_eraser( $args['comment_author_email'] );
     256
     257        $clauses = $filter->get_args()[0][0];
     258
     259        $this->assertStringContainsString( 'comment_ID', $clauses['orderby'] );
     260    }
    232261}
Note: See TracChangeset for help on using the changeset viewer.