WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/05/2021 03:48:59 PM (4 months ago)
Author:
SergeyBiryukov
Message:

Privacy: Rename the $send_confirmation_email parameter of wp_create_user_request() to $status, for clarity.

Follow-up to [50159], [50165].

Props xkon, TimothyBlynJacobs.
Fixes #52430. See #43890.

File:
1 edited

Legend:

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

    r50160 r50230  
    311311
    312312    /**
    313      * Test that the request has a Pending status if a confirmation email is sent.
     313     * Test that the request has a Pending status by default.
    314314     *
    315315     * @ticket 43890
    316316     */
    317     public function test_pending_status_with_default_wp_create_user_request_params() {
     317    public function test_wp_create_user_request_default_pending_status() {
    318318        $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data' );
    319319        $post   = get_post( $actual );
     
    323323
    324324    /**
    325      * Test that the request has a Pending status if the $send_confirmation_email param is true.
     325     * Test that the request has a Pending status if the $status param is 'pending'.
    326326     *
    327327     * @ticket 43890
    328328     */
    329     public function test_pending_status_with_true_send_confirmation_email() {
    330         $request_data            = array();
    331         $send_confirmation_email = true;
    332 
    333         $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', $request_data, $send_confirmation_email );
     329    public function test_wp_create_user_request_pending_status() {
     330        $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', array(), 'pending' );
    334331        $post   = get_post( $actual );
    335332
     
    338335
    339336    /**
    340      * Test that the request has a Completed status if the $send_confirmation_email param is false.
     337     * Test that the request has a Confirmed status if the $status param is 'confirmed'.
    341338     *
    342339     * @ticket 43890
    343340     */
    344     public function test_pending_status_with_false_send_confirmation_email() {
    345         $request_data            = array();
    346         $send_confirmation_email = false;
    347 
    348         $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', $request_data, $send_confirmation_email );
     341    public function test_wp_create_user_request_confirmed_status() {
     342        $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', array(), 'confirmed' );
    349343        $post   = get_post( $actual );
    350344
    351         $this->assertSame( 'request-completed', $post->post_status );
     345        $this->assertSame( 'request-confirmed', $post->post_status );
     346    }
     347
     348    /**
     349     * Test that the request returns a WP_Error if $status isn't 'pending' or 'confirmed'.
     350     *
     351     * @ticket 43890
     352     */
     353    public function test_wp_create_user_request_wp_error_status() {
     354        $actual = wp_create_user_request( self::$non_registered_user_email, 'export_personal_data', array(), 'wrong-status' );
     355
     356        $this->assertWPError( $actual );
    352357    }
    353358}
Note: See TracChangeset for help on using the changeset viewer.