Make WordPress Core


Ignore:
Timestamp:
01/30/2018 12:20:37 AM (7 years ago)
Author:
westonruter
Message:

Customize: Ensure customize_autosaved requests only use revision of logged-in user.

Props dlh, westonruter.
See #42433, #39896.
Fixes #42450.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/CustomizeManager.php

    r42343 r42615  
    553553     */
    554554    public function test_handle_dismiss_autosave_or_lock_request() {
    555         $uuid         = wp_generate_uuid4();
    556         $wp_customize = $this->set_up_valid_state( $uuid );
     555        $uuid          = wp_generate_uuid4();
     556        $wp_customize  = $this->set_up_valid_state( $uuid );
     557        $valid_user_id = get_current_user_id();
     558
     559        // Temporarily remove user to test requirement that user is logged in. See #42450.
     560        wp_set_current_user( 0 );
     561        $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' );
     562        $this->assertFalse( $this->_last_response_parsed['success'] );
     563        $this->assertEquals( 'unauthenticated', $this->_last_response_parsed['data'] );
     564        wp_set_current_user( $valid_user_id );
    557565
    558566        $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' );
Note: See TracChangeset for help on using the changeset viewer.