mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 02:34:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@41372 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1412,6 +1412,24 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
$this->assertEquals( $new_sidebar_1, $updated_sidebars_widgets['sidebar-1'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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().
|
||||
*
|
||||
* @ticket 41336
|
||||
* @covers WP_Customize_Manager::save_changeset_post
|
||||
*/
|
||||
function test_publish_changeset_with_future_status_when_future_date() {
|
||||
$wp_customize = $this->create_test_manager( wp_generate_uuid4() );
|
||||
|
||||
$wp_customize->save_changeset_post( array(
|
||||
'date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
|
||||
'status' => 'publish',
|
||||
'title' => 'Foo',
|
||||
) );
|
||||
|
||||
$this->assertSame( 'future', get_post_status( $wp_customize->changeset_post_id() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that save_changeset_post method bails updating an underlying changeset which is invalid.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user