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/wpCommentsPersonalDataExporter.php

    r55322 r55324  
    133133        $this->assertCount( 0, $actual['data'] );
    134134    }
     135
     136    /**
     137     * Testing that `wp_comments_personal_data_exporter()` orders comments by ID.
     138     *
     139     * @ticket 57700
     140     */
     141    public function test_wp_comments_personal_data_exporter_orders_comments_by_id() {
     142
     143        $args = array(
     144            'comment_post_ID'      => self::$post_id,
     145            'comment_author'       => 'Comment Author',
     146            'comment_author_email' => 'personal@local.host',
     147            'comment_author_url'   => 'https://local.host/',
     148            'comment_author_IP'    => '192.168.0.1',
     149            'comment_date'         => '2018-03-28 20:05:00',
     150            'comment_agent'        => 'SOME_AGENT',
     151            'comment_content'      => 'Comment',
     152        );
     153        self::factory()->comment->create( $args );
     154
     155        $filter = new MockAction();
     156        add_filter( 'comments_clauses', array( &$filter, 'filter' ) );
     157
     158        wp_comments_personal_data_exporter( $args['comment_author_email'] );
     159
     160        $clauses = $filter->get_args()[0][0];
     161
     162        $this->assertStringContainsString( 'comment_ID', $clauses['orderby'] );
     163    }
    135164}
Note: See TracChangeset for help on using the changeset viewer.