Changeset 47338 for branches/3.8/tests/phpunit/tests/post/revisions.php
- Timestamp:
- 02/21/2020 01:05:39 PM (5 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
- Property svn:mergeinfo changed
-
branches/3.8/tests/phpunit/tests/post/revisions.php
r32150 r47338 54 54 55 55 wp_set_current_user( 0 ); 56 }57 58 /**59 * @ticket 739260 * @ticket 984361 */62 function test_revision_dont_save_revision_if_unchanged() {63 $post = get_default_post_to_edit( 'post', true );64 $post_id = $post->ID;65 66 $this->assertCount( 0, wp_get_post_revisions( $post_id ) ); // No revisions on auto-draft creation.67 68 wp_update_post( array( 'post_status' => 'draft', 'post_title' => 'some-post', 'post_content' => 'some_content', 'ID' => $post_id ) );69 70 $this->assertCount( 1, wp_get_post_revisions( $post_id ) ); // Just the initial revision71 72 // First update73 wp_update_post( array( 'post_content' => 'some updated content', 'ID' => $post_id ) );74 75 $this->assertCount( 2, wp_get_post_revisions( $post_id ) ); // should be 2 revisions so far76 77 //update the post78 wp_update_post( array( 'post_content' => 'new update for some updated content', 'ID' => $post_id ) ); //2nd revision79 $this->assertCount( 3, wp_get_post_revisions( $post_id ) ); // should be 3 revision so far80 81 //next try to save another identical update, tests for patch that prevents storing duplicates82 wp_update_post( array( 'post_content' => 'new update for some updated content', 'ID' => $post_id ) ); //content unchanged, shouldn't save83 $this->assertCount( 3, wp_get_post_revisions( $post_id ) ); //should still be 3 revision84 85 //next try to save another update, same content, but new ttile, should save revision86 wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content' => 'new update for some updated content', 'ID' => $post_id ) );87 $this->assertCount( 4, wp_get_post_revisions( $post_id ) ); //should be 4 revision88 89 //next try to save another identical update90 wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content' => 'new update for some updated content', 'ID' => $post_id ) ); //content unchanged, shouldn't save91 $this->assertCount( 4, wp_get_post_revisions( $post_id ) ); //should still be 4 revision92 56 } 93 57
Note: See TracChangeset
for help on using the changeset viewer.