Changeset 34681
- Timestamp:
- 09/29/2015 04:04:16 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r34603 r34681 1325 1325 1326 1326 if ( ! empty( $dateCreated ) ) { 1327 $post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ));1328 $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT');1327 $post_data['post_date'] = iso8601_to_datetime( $dateCreated ); 1328 $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); 1329 1329 } 1330 1330 … … 3396 3396 // We know this is supposed to be GMT, so we're going to slap that Z on there by force 3397 3397 $dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z'; 3398 $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));3399 $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');3398 $comment_date = iso8601_to_datetime( $dateCreated ); 3399 $comment_date_gmt = get_gmt_from_date( $comment_date ); 3400 3400 } 3401 3401 … … 4961 4961 4962 4962 if ( !empty( $dateCreated ) ) { 4963 $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));4964 $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');4963 $post_date = iso8601_to_datetime( $dateCreated ); 4964 $post_date_gmt = get_gmt_from_date( $post_date ); 4965 4965 } else { 4966 4966 $post_date = ''; … … 5315 5315 5316 5316 if ( !empty( $dateCreated ) ) { 5317 $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));5318 $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');5317 $post_date = iso8601_to_datetime( $dateCreated ); 5318 $post_date_gmt = get_gmt_from_date( $post_date, 'GMT' ); 5319 5319 } else { 5320 5320 $post_date = $postdata['post_date']; -
trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php
r33612 r34681 230 230 $this->assertEquals( $result->code, 401 ); 231 231 } 232 233 /** 234 * @ticket 30429 235 */ 236 function test_post_date_timezone_conversion() { 237 $tz = get_option( 'timezone_string' ); 238 update_option( 'timezone_string', 'America/New_York' ); 239 240 $editor_id = $this->make_user_by_role( 'editor' ); 241 242 $post_id = $this->factory->post->create( array( 243 'post_author' => $editor_id 244 ) ); 245 246 $date_string = '1984-01-11 05:00:00'; 247 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', array( 248 'dateCreated' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ), 249 ) ) ); 250 251 $fetched_post = get_post( $post_id ); 252 253 update_option( 'timezone_string', $tz ); 254 255 $this->assertTrue( $result ); 256 $this->assertEquals( $date_string, $fetched_post->post_date ); 257 } 232 258 } -
trunk/tests/phpunit/tests/xmlrpc/mw/newPost.php
r34572 r34681 181 181 $this->assertEquals( '0000-00-00 00:00:00', $out->post_date_gmt ); 182 182 } 183 184 /** 185 * @ticket 30429 186 */ 187 function test_post_date_timezone_conversion() { 188 $tz = get_option( 'timezone_string' ); 189 update_option( 'timezone_string', 'America/New_York' ); 190 191 $this->make_user_by_role( 'editor' ); 192 $date_string = '1984-01-11 05:00:00'; 193 $post = array( 194 'title' => 'test', 195 'post_content' => 'test', 196 'dateCreated' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) 197 ); 198 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) ); 199 $fetched_post = get_post( $result ); 200 201 update_option( 'timezone_string', $tz ); 202 203 $this->assertStringMatchesFormat( '%d', $result ); 204 $this->assertEquals( $date_string , $fetched_post->post_date ); 205 } 183 206 } -
trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
r34570 r34681 70 70 $this->assertEquals( 'trash', get_comment( $comment_id )->comment_approved ); 71 71 } 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 = $this->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 } 72 104 } -
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r29063 r34681 384 384 } 385 385 386 /** 387 * @ticket 30429 388 */ 389 function test_post_date_timezone_conversion() { 390 $tz = get_option( 'timezone_string' ); 391 update_option( 'timezone_string', 'America/New_York' ); 392 393 $this->make_user_by_role( 'author' ); 394 $date_string = '1984-01-11 05:00:00'; 395 $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string ); 396 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 397 $fetched_post = get_post( $result ); 398 399 update_option( 'timezone_string', $tz ); 400 401 $this->assertStringMatchesFormat( '%d', $result ); 402 $this->assertEquals( $date_string , $fetched_post->post_date ); 403 } 386 404 }
Note: See TracChangeset
for help on using the changeset viewer.