| | 385 | |
| | 386 | /** |
| | 387 | * @ticket 39011 |
| | 388 | */ |
| | 389 | function test_wp_first_revision_is_not_lost() { |
| | 390 | $post = self::factory()->post->create_and_get( array( |
| | 391 | 'post_title' => 'some-post', |
| | 392 | 'post_type' => 'post', |
| | 393 | 'post_content' => 'Initial Content', |
| | 394 | ) ); |
| | 395 | |
| | 396 | wp_update_post( array( |
| | 397 | 'ID' => $post->ID, |
| | 398 | 'post_content' => 'Update #1', |
| | 399 | ) ); |
| | 400 | |
| | 401 | wp_update_post( array( |
| | 402 | 'ID' => $post->ID, |
| | 403 | 'post_content' => 'Update #2', |
| | 404 | ) ); |
| | 405 | |
| | 406 | $revisions = wp_get_post_revisions( $post->ID ); |
| | 407 | $earliest_revision = end( $revisions ); |
| | 408 | |
| | 409 | $this->assertEquals( 'Initial Content', $earliest_revision->post_content ); |
| | 410 | } |