Changeset 48952 for trunk/tests/phpunit/tests/date/dateI18n.php
- Timestamp:
- 09/07/2020 03:12:17 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/date/dateI18n.php
r48937 r48952 17 17 $wp_timestamp = $datetime->getTimestamp() + $datetime->getOffset(); 18 18 19 $this->assertEquals ( $wp_timestamp, date_i18n( 'U', 'invalid' ), '', 5);19 $this->assertEqualsWithDelta( $wp_timestamp, date_i18n( 'U', 'invalid' ), 5, 'The dates should be equal' ); 20 20 } 21 21 … … 39 39 40 40 public function test_should_format_date() { 41 $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);41 $this->assertEqualsWithDelta( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 2, 'The dates should be equal' ); 42 42 } 43 43 … … 47 47 48 48 public function test_date_should_be_in_gmt() { 49 $this->assertEquals ( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2);49 $this->assertEqualsWithDelta( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 2, 'The dates should be equal' ); 50 50 } 51 51 … … 53 53 update_option( 'timezone_string', 'America/Regina' ); 54 54 55 $this->assertEquals ( strtotime( gmdate( 'Y-m-d H:i:s', time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2);55 $this->assertEqualsWithDelta( strtotime( gmdate( 'Y-m-d H:i:s', time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 2, 'The dates should be equal' ); 56 56 } 57 57 … … 59 59 update_option( 'timezone_string', 'America/Regina' ); 60 60 61 $this->assertEquals ( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2);61 $this->assertEqualsWithDelta( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 2, 'The dates should be equal' ); 62 62 } 63 63 … … 122 122 update_option( 'timezone_string', 'America/Regina' ); 123 123 124 $this->assertEquals ( strtotime( date_i18n( $full ) ), strtotime( date_i18n( $short ) ), 'The dates should be equal', 2);124 $this->assertEqualsWithDelta( strtotime( date_i18n( $full ) ), strtotime( date_i18n( $short ) ), 2, 'The dates should be equal' ); 125 125 $this->assertSame( $short, date_i18n( '\\' . $short ) ); 126 126 } … … 149 149 $wp_timestamp = $timestamp + $datetime->getOffset(); 150 150 151 $this->assertEquals ( $wp_timestamp, date_i18n( 'U' ), 'The dates should be equal', 2);152 $this->assertEquals ( $timestamp, date_i18n( 'U', false, true ), 'The dates should be equal', 2);151 $this->assertEqualsWithDelta( $wp_timestamp, date_i18n( 'U' ), 2, 'The dates should be equal' ); 152 $this->assertEqualsWithDelta( $timestamp, date_i18n( 'U', false, true ), 2, 'The dates should be equal' ); 153 153 $this->assertSame( $wp_timestamp, date_i18n( 'U', $wp_timestamp ) ); 154 154 }
Note: See TracChangeset
for help on using the changeset viewer.