WordPress.org

Make WordPress Core

Ticket #22944: 22944.test.patch

File 22944.test.patch, 967 bytes (added by SergeyBiryukov, 5 years ago)
  • trunk/tests/post.php

     
    520520
    521521                $this->assertEquals( 'publish', $post->post_status );
    522522        }
     523
     524        /**
     525         * @ticket 22944
     526         */
     527        function test_wp_publish_future_post() {
     528                $future_date = strtotime( '+1 day' );
     529                $content = '<iframe width="420" height="315" src="http://www.youtube.com/embed/oHg5SJYRHA0?rel=0" frameborder="0" allowfullscreen></iframe>';
     530
     531                $post_id = $this->factory->post->create( array(
     532                        'post_content' => $content,
     533                        'post_date' => strftime( '%Y-%m-%d %H:%M:%S', $future_date )
     534                ) );
     535
     536                $post = get_post( $post_id );
     537                $this->assertEquals( 'future', $post->post_status );
     538
     539                wp_publish_post( $post_id );
     540                $post = get_post( $post_id );
     541
     542                $this->assertEquals( 'publish', $post->post_status );
     543                $this->assertEquals( $content, $post->post_content );
     544        }
    523545}