Changeset 45914 for trunk/tests/phpunit/tests/date/dateI18n.php
- Timestamp:
- 08/29/2019 11:17:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/date/dateI18n.php
r45902 r45914 6 6 */ 7 7 class Tests_Date_I18n extends WP_UnitTestCase { 8 9 /** 10 * @ticket 28636 11 */ 12 public function test_should_return_current_time_on_invalid_timestamp() { 13 $timezone = 'Europe/Kiev'; 14 update_option( 'timezone_string', $timezone ); 15 16 $datetime = new DateTime( 'now', new DateTimeZone( $timezone ) ); 17 $wp_timestamp = $datetime->getTimestamp() + $datetime->getOffset(); 18 19 $this->assertEquals( $wp_timestamp, date_i18n( 'U', 'invalid' ), '', 5 ); 20 } 21 8 22 public function test_should_format_date() { 9 23 $this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); … … 75 89 $offset = $datetimezone->getOffset( new DateTime() ) / 3600; 76 90 update_option( 'gmt_offset', $offset ); 91 77 92 $datetime = new DateTime( 'now', $datetimezone ); 78 93 $datetime = new DateTime( $datetime->format( 'P' ) );
Note: See TracChangeset
for help on using the changeset viewer.