| | 86 | |
| | 87 | /** |
| | 88 | * When updating a draft in quick edit mode, it should not set the publish date of the post when this one will be published. |
| | 89 | * |
| | 90 | * @ticket 19907 |
| | 91 | */ |
| | 92 | public function test_quick_edit_draft_should_not_set_publish_date() { |
| | 93 | // Become an administrator. |
| | 94 | $this->_setRole( 'administrator' ); |
| | 95 | |
| | 96 | $user = get_current_user_id(); |
| | 97 | |
| | 98 | $post = self::factory()->post->create_and_get( |
| | 99 | array( |
| | 100 | 'post_status' => 'draft', |
| | 101 | 'post_author' => $user, |
| | 102 | ) |
| | 103 | ); |
| | 104 | |
| | 105 | $this->assertSame( 'draft', $post->post_status ); |
| | 106 | |
| | 107 | $this->assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt ); |
| | 108 | |
| | 109 | // Set up a request. |
| | 110 | $_POST['_inline_edit'] = wp_create_nonce( 'inlineeditnonce' ); |
| | 111 | $_POST['post_ID'] = $post->ID; |
| | 112 | $_POST['post_type'] = 'post'; |
| | 113 | $_POST['content'] = 'content test'; |
| | 114 | $_POST['excerpt'] = 'excerpt test'; |
| | 115 | $_POST['_status'] = $post->post_status; |
| | 116 | $_POST['post_status'] = $post->post_status; |
| | 117 | $_POST['post_author'] = $user; |
| | 118 | $_POST['screen'] = 'edit-post'; |
| | 119 | $_POST['post_view'] = 'list'; |
| | 120 | $_POST['edit_date'] = true; |
| | 121 | $_POST['mm'] = '09'; |
| | 122 | $_POST['jj'] = 11; |
| | 123 | $_POST['aa'] = 2020; |
| | 124 | $_POST['hh'] = 19; |
| | 125 | $_POST['mn'] = 20; |
| | 126 | $_POST['ss'] = 11; |
| | 127 | |
| | 128 | // Make the request. |
| | 129 | try { |
| | 130 | $this->_handleAjax( 'inline-save' ); |
| | 131 | } catch ( WPAjaxDieContinueException $e ) { |
| | 132 | unset( $e ); |
| | 133 | } |
| | 134 | |
| | 135 | $post = get_post( $post->ID ); |
| | 136 | |
| | 137 | $this->assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt ); |
| | 138 | } |