Changeset 36164
- Timestamp:
- 01/03/2016 07:49:34 PM (9 years ago)
- Location:
- branches/4.4
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4
-
branches/4.4/src/wp-includes/class-wp-xmlrpc-server.php
r35479 r36164 1350 1350 1351 1351 if ( ! empty( $dateCreated ) ) { 1352 $post_data['post_date'] = iso8601_to_datetime( $dateCreated);1353 $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date']);1352 $post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) ); 1353 $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' ); 1354 1354 } 1355 1355 … … 3424 3424 // We know this is supposed to be GMT, so we're going to slap that Z on there by force 3425 3425 $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; 3426 $comment_date = iso8601_to_datetime( $dateCreated);3427 $comment_date_gmt = get_gmt_from_date( $comment_date);3426 $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); 3427 $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); 3428 3428 } 3429 3429 … … 4992 4992 4993 4993 if ( !empty( $dateCreated ) ) { 4994 $post_date = iso8601_to_datetime( $dateCreated);4995 $post_date_gmt = get_gmt_from_date( $post_date);4994 $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); 4995 $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); 4996 4996 } else { 4997 4997 $post_date = ''; … … 5346 5346 5347 5347 if ( !empty( $dateCreated ) ) { 5348 $post_date = iso8601_to_datetime( $dateCreated);5349 $post_date_gmt = get_gmt_from_date( $post_date, 'GMT');5348 $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); 5349 $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); 5350 5350 } else { 5351 5351 $post_date = $postdata['post_date']; -
branches/4.4/tests/phpunit/tests/xmlrpc/mw/editPost.php
r35242 r36164 221 221 222 222 /** 223 * @ticket 30429224 */225 function test_post_date_timezone_conversion() {226 $tz = get_option( 'timezone_string' );227 update_option( 'timezone_string', 'America/New_York' );228 229 $editor_id = $this->make_user_by_role( 'editor' );230 231 $post_id = self::factory()->post->create( array(232 'post_author' => $editor_id233 ) );234 235 $date_string = '1984-01-11 05:00:00';236 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', array(237 'dateCreated' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ),238 ) ) );239 240 $fetched_post = get_post( $post_id );241 242 update_option( 'timezone_string', $tz );243 244 $this->assertTrue( $result );245 $this->assertEquals( $date_string, $fetched_post->post_date );246 }247 248 /**249 223 * @ticket 16980 250 224 */ -
branches/4.4/tests/phpunit/tests/xmlrpc/mw/newPost.php
r35242 r36164 171 171 $this->assertEquals( '0000-00-00 00:00:00', $out->post_date_gmt ); 172 172 } 173 174 /**175 * @ticket 30429176 */177 function test_post_date_timezone_conversion() {178 $tz = get_option( 'timezone_string' );179 update_option( 'timezone_string', 'America/New_York' );180 181 $this->make_user_by_role( 'editor' );182 $date_string = '1984-01-11 05:00:00';183 $post = array(184 'title' => 'test',185 'post_content' => 'test',186 'dateCreated' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) )187 );188 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );189 $fetched_post = get_post( $result );190 191 update_option( 'timezone_string', $tz );192 193 $this->assertStringMatchesFormat( '%d', $result );194 $this->assertEquals( $date_string , $fetched_post->post_date );195 }196 173 } -
branches/4.4/tests/phpunit/tests/xmlrpc/wp/editComment.php
r35242 r36164 70 70 $this->assertEquals( 'trash', get_comment( $comment_id )->comment_approved ); 71 71 } 72 73 /**74 * @ticket 3042975 */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 }104 72 } -
branches/4.4/tests/phpunit/tests/xmlrpc/wp/newPost.php
r35242 r36164 374 374 } 375 375 376 /**377 * @ticket 30429378 */379 function test_post_date_timezone_conversion() {380 $tz = get_option( 'timezone_string' );381 update_option( 'timezone_string', 'America/New_York' );382 383 $this->make_user_by_role( 'author' );384 $date_string = '1984-01-11 05:00:00';385 $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string );386 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );387 $fetched_post = get_post( $result );388 389 update_option( 'timezone_string', $tz );390 391 $this->assertStringMatchesFormat( '%d', $result );392 $this->assertEquals( $date_string , $fetched_post->post_date );393 }394 376 }
Note: See TracChangeset
for help on using the changeset viewer.