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