| 1433 | |
| 1434 | /** |
| 1435 | * @ticket |
| 1436 | */ |
| 1437 | function test_get_post_time_with_id_returns_correct_time_after_timezone_change() { |
| 1438 | // Make sure WordPress is set to UTC+0 and create a new post. |
| 1439 | update_option( 'gmt_offset', 0 ); |
| 1440 | $post_id = self::factory()->post->create( array( 'post_date' => '2019-10-21 11:20:58' ) ); |
| 1441 | |
| 1442 | // Change the timezine to UTC+2 |
| 1443 | update_option( 'gmt_offset', 2 ); |
| 1444 | |
| 1445 | // Attempt to obtain the GMT post date (should be identical with the original post_date set above). |
| 1446 | $this->assertEquals( '11:20:58', get_post_time( 'H:i:s', true, $post_id ) ); |
| 1447 | } |