- Timestamp:
- 12/17/2019 08:52:44 PM (6 years ago)
- Location:
- branches/5.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.3
- Property svn:mergeinfo changed
/trunk merged: 46973-46974
- Property svn:mergeinfo changed
-
branches/5.3/tests/phpunit/tests/date/getFeedBuildDate.php
r46774 r46977 37 37 $this->assertEquals( '2018-07-23T03:13:23+00:00', get_feed_build_date( DATE_RFC3339 ) ); 38 38 } 39 40 /** 41 * Test that get_feed_build_date() works with invalid post dates. 42 * 43 * @ticket 48957 44 */ 45 public function test_should_fall_back_to_last_post_modified() { 46 global $wp_query; 47 48 update_option( 'timezone_string', 'Europe/Kiev' ); 49 $datetime = new DateTimeImmutable( 'now', wp_timezone() ); 50 $datetime_utc = $datetime->setTimezone( new DateTimeZone( 'UTC' ) ); 51 52 $wp_query->posts = array(); 53 54 $this->assertFalse( get_feed_build_date( DATE_RFC3339 ), 'False when unable to determine valid time' ); 55 56 $this->factory->post->create( 57 array( 58 'post_date' => $datetime->format( 'Y-m-d H:i:s' ), 59 ) 60 ); 61 62 $this->assertEquals( 63 $datetime_utc->format( DATE_RFC3339 ), 64 get_feed_build_date( DATE_RFC3339 ), 65 'Fall back to time of last post modified with no posts' 66 ); 67 68 $post_id_broken = $this->factory->post->create(); 69 $post_broken = get_post( $post_id_broken ); 70 71 $post_broken->post_modified_gmt = 0; 72 73 $wp_query->posts = array( $post_broken ); 74 75 $this->assertEquals( 76 $datetime_utc->format( DATE_RFC3339 ), 77 get_feed_build_date( DATE_RFC3339 ), 78 'Fall back to time of last post modified with broken post object' 79 ); 80 } 39 81 }
Note: See TracChangeset
for help on using the changeset viewer.