WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r30431 r29341  
    655655        $this->assertNotContains( 'key', $metas );
    656656    }
    657 
    658     function test_changing_email_invalidates_password_reset_key() {
    659         global $wpdb;
    660 
    661         $user = $this->factory->user->create_and_get();
    662         $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
    663         clean_user_cache( $user );
    664 
    665         $user = get_userdata( $user->ID );
    666         $this->assertEquals( 'key', $user->user_activation_key );
    667 
    668         // Check that changing something other than the email doesn't remove the key.
    669         $userdata = array(
    670             'ID'            => $user->ID,
    671             'user_nicename' => 'wat',
    672         );
    673         wp_update_user( $userdata );
    674 
    675         $user = get_userdata( $user->ID );
    676         $this->assertEquals( 'key', $user->user_activation_key );
    677 
    678         // Now check that changing the email does remove it.
    679         $userdata = array(
    680             'ID'            => $user->ID,
    681             'user_nicename' => 'cat',
    682             'user_email'    => 'foo@bar.dev',
    683         );
    684         wp_update_user( $userdata );
    685 
    686         $user = get_userdata( $user->ID );
    687         $this->assertEmpty( $user->user_activation_key );
    688     }
    689657}
Note: See TracChangeset for help on using the changeset viewer.