WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php

    r36164 r35242  
    7070        $this->assertEquals( 'trash', get_comment( $comment_id )->comment_approved );
    7171    }
     72
     73    /**
     74     * @ticket 30429
     75     */
     76    function test_post_date_timezone_conversion() {
     77        $tz = get_option( 'timezone_string' );
     78        update_option( 'timezone_string', 'America/New_York' );
     79
     80        $this->make_user_by_role( 'administrator' );
     81        $post_id = self::factory()->post->create();
     82
     83        $comment_data = array(
     84            'comment_post_ID' => $post_id,
     85            'comment_author' => 'Test commenter',
     86            'comment_author_url' => 'http://example.com/',
     87            'comment_author_email' => 'example@example.com',
     88            'comment_content' => rand_str( 100 ),
     89            'comment_approved' => '1',
     90        );
     91        $comment_id = wp_insert_comment( $comment_data );
     92
     93        $date_string = '1984-01-11 05:00:00';
     94        $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'administrator', 'administrator', $comment_id, array(
     95            'date_created_gmt' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) )
     96        ) ) );
     97        $fetched_comment = get_comment( $comment_id );
     98
     99        update_option( 'timezone_string', $tz );
     100
     101        $this->assertTrue( $result );
     102        $this->assertEquals( $date_string, $fetched_comment->comment_date );
     103    }
    72104}
Note: See TracChangeset for help on using the changeset viewer.