Changeset 34762
- Timestamp:
- 10/02/2015 04:35:34 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-functions.php
r34746 r34762 3013 3013 */ 3014 3014 if ( empty( $postarr['post_date'] ) || '0000-00-00 00:00:00' == $postarr['post_date'] ) { 3015 $post_date = current_time( 'mysql' ); 3015 if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) { 3016 $post_date = current_time( 'mysql' ); 3017 } else { 3018 $post_date = get_date_from_gmt( $postarr['post_date_gmt'] ); 3019 } 3016 3020 } else { 3017 3021 $post_date = $postarr['post_date']; -
trunk/tests/phpunit/tests/post.php
r34085 r34762 1219 1219 $this->assertEquals( $this->author_id, get_post( $post_id )->post_author ); 1220 1220 } 1221 1222 /** 1223 * @ticket 15946 1224 */ 1225 function test_wp_insert_post_should_respect_post_date_gmt() { 1226 $post = array( 1227 'post_author' => $this->author_id, 1228 'post_status' => 'publish', 1229 'post_content' => rand_str(), 1230 'post_title' => rand_str(), 1231 'post_date_gmt' => '2014-01-01 12:00:00', 1232 ); 1233 1234 // insert a post and make sure the ID is ok 1235 $id = wp_insert_post($post); 1236 1237 $out = get_post($id); 1238 1239 $this->assertEquals($post['post_content'], $out->post_content); 1240 $this->assertEquals($post['post_title'], $out->post_title); 1241 $this->assertEquals($post['post_author'], $out->post_author); 1242 $this->assertEquals(get_date_from_gmt($post['post_date_gmt']), $out->post_date); 1243 $this->assertEquals($post['post_date_gmt'], $out->post_date_gmt); 1244 } 1221 1245 }
Note: See TracChangeset
for help on using the changeset viewer.