Make WordPress Core

Ticket #23923: 23923.reproduce.diff

File 23923.reproduce.diff, 1.0 KB (added by kovshenin, 11 years ago)
  • tests/post/revisions.php

     
    1717        }
    1818
    1919        /**
     20         * @ticket 23923
     21         */
     22        function test_reproduce_23923() {
     23                $ok = 0;
     24                $reversed = 0;
     25
     26                for ( $i = 0; $i < 100; $i++ ) {
     27                        $post_id = $this->factory->post->create( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
     28                        for ( $j = 1; $j < 3; $j++ )
     29                                wp_update_post( array( 'post_content' => 'updated post' . $j , 'ID' => $post_id ) );
     30
     31                        $revisions = wp_get_post_revisions( $post_id );
     32                        $first = array_shift( $revisions );
     33                        $last = array_pop( $revisions );
     34
     35                        ( $first->ID < $last->ID ) ? $reversed++ : $ok++;
     36                }
     37
     38                printf( "OK: %d, Reversed: %d", $ok, $reversed );
     39        }
     40
     41        /**
    2042         * Note: Test needs reviewing when #16215 is fixed because I'm not sure the test current tests the "correct" behavior
    2143         * @ticket 20982
    2244         * @ticket 16215