Make WordPress Core


Ignore:
Timestamp:
07/03/2024 04:08:55 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Users: Pass the previous state of the user as context to the wp_set_password hook.

Follow-up to [55056], [55250].

Props dd32.
Fixes #61541.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/auth.php

    r58341 r58653  
    116116         *
    117117         * @ticket 57436
     118         * @ticket 61541
    118119         *
    119120         * @covers ::wp_set_password
     
    122123                $action = new MockAction();
    123124
    124                 add_action( 'wp_set_password', array( $action, 'action' ) );
    125                 wp_set_password( 'A simple password', self::$user_id );
     125                $previous_user_pass = get_user_by( 'id', $this->user->ID )->user_pass;
     126
     127                add_action( 'wp_set_password', array( $action, 'action' ), 10, 3 );
     128                wp_set_password( 'A simple password', $this->user->ID );
    126129
    127130                $this->assertSame( 1, $action->get_call_count() );
     131
     132                // Check that the old data passed through the hook is correct.
     133                $this->assertSame( $previous_user_pass, $action->get_args()[0][2]->user_pass );
    128134        }
    129135
Note: See TracChangeset for help on using the changeset viewer.