WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/11/2017 05:49:58 PM (3 years ago)
Author:
westonruter
Message:

Customize: Align behavior of WP_Customize_Manager::save_changeset_post() with wp_insert_post() by setting status to future if supplied status is publish but date is future.

Props dlh.
Fixes #41336.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/manager.php

    r41321 r41372  
    14141414
    14151415    /**
     1416     * Ensure that saving a changeset with a publish status but future date will change the status to future, to align with behavior in wp_insert_post().
     1417     *
     1418     * @ticket 41336
     1419     * @covers WP_Customize_Manager::save_changeset_post
     1420     */
     1421    function test_publish_changeset_with_future_status_when_future_date() {
     1422        $wp_customize = $this->create_test_manager( wp_generate_uuid4() );
     1423
     1424        $wp_customize->save_changeset_post( array(
     1425            'date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
     1426            'status' => 'publish',
     1427            'title' => 'Foo',
     1428        ) );
     1429
     1430        $this->assertSame( 'future', get_post_status( $wp_customize->changeset_post_id() ) );
     1431    }
     1432
     1433    /**
    14161434     * Ensure that save_changeset_post method bails updating an underlying changeset which is invalid.
    14171435     *
Note: See TracChangeset for help on using the changeset viewer.