Changeset 46580 for trunk/tests/phpunit/tests/date/postTime.php
- Timestamp:
- 10/25/2019 01:06:29 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/date/postTime.php
r46154 r46580 63 63 $this->assertEquals( $rfc3339_utc, get_post_modified_time( DATE_RFC3339, true, $post_id, true ) ); 64 64 } 65 66 /** 67 * @ticket 48384 68 */ 69 public function test_should_keep_utc_time_on_timezone_change_with_gmt_offset() { 70 // Set the timezone to UTC+0. 71 update_option( 'gmt_offset', 0 ); 72 73 $datetime = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) ); 74 $mysql = $datetime->format( 'Y-m-d H:i:s' ); 75 $rfc3339 = $datetime->format( DATE_RFC3339 ); 76 $post_id = self::factory()->post->create( 77 array( 78 'post_date' => $mysql, 79 'post_modified' => $mysql, 80 ) 81 ); 82 83 // Change the timezone to UTC+2. 84 update_option( 'gmt_offset', 2 ); 85 86 $this->assertEquals( $rfc3339, get_post_time( DATE_RFC3339, true, $post_id ) ); 87 $this->assertEquals( $rfc3339, get_post_modified_time( DATE_RFC3339, true, $post_id ) ); 88 } 89 90 /** 91 * @ticket 48384 92 */ 93 public function test_should_keep_utc_time_on_timezone_change() { 94 $timezone = 'UTC'; 95 update_option( 'timezone_string', $timezone ); 96 97 $datetime = new DateTimeImmutable( 'now', new DateTimeZone( $timezone ) ); 98 $mysql = $datetime->format( 'Y-m-d H:i:s' ); 99 $rfc3339 = $datetime->format( DATE_RFC3339 ); 100 $post_id = self::factory()->post->create( 101 array( 102 'post_date' => $mysql, 103 'post_modified' => $mysql, 104 ) 105 ); 106 107 update_option( 'timezone_string', 'Europe/Kiev' ); 108 109 $this->assertEquals( $rfc3339, get_post_time( DATE_RFC3339, true, $post_id ) ); 110 $this->assertEquals( $rfc3339, get_post_modified_time( DATE_RFC3339, true, $post_id ) ); 111 } 65 112 }
Note: See TracChangeset
for help on using the changeset viewer.