[wp-trac] [WordPress Trac] #26219: Tests_Post_Revisions::test_revision_dont_save_revision_if_unchanged unit test fails

WordPress Trac noreply at wordpress.org
Sun Nov 24 18:23:06 UTC 2013


#26219: Tests_Post_Revisions::test_revision_dont_save_revision_if_unchanged unit
test fails
----------------------------+-----------------------------
 Reporter:  nunomorgadinho  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Unit Tests      |    Version:  trunk
 Severity:  normal          |   Keywords:  has-patch
----------------------------+-----------------------------
 This unit test is failing:

 1) Tests_Post_Revisions::test_revision_dont_save_revision_if_unchanged
 Failed asserting that actual size 4 matches expected size 3.

 in tests/phpunit/tests/post/revisions.php:83

 I've traced the problem down to wp-includes/revision.php line 95:

 {{{
         if ( $revisions = wp_get_post_revisions( $post_id ) ) {
                 // grab the last revision, but not an autosave
                 foreach ( $revisions as $revision ) {
                         if ( false !== strpos( $revision->post_name,
 "{$revision->post_parent}-revision" ) ) {
                                 $last_revision = $revision;
                                 break;
                         }
                 }
 }}}

 When creating the revisions programmatically it seems $last_revision is
 not fetched correctly. Since revisions are ordered I wonder if we could
 replace this code by one where we just grab the last revision out of the
 revisions array directly.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26219>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list