Changeset 53556
- Timestamp:
- 06/22/2022 04:50:14 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/sitemaps/wpSitemapsPosts.php
r53550 r53556 64 64 65 65 /** 66 * Callback for 'wp_sitemaps_posts_show_on_front_entry' filter. 67 */ 68 public function _show_on_front_entry( $sitemap_entry ) { 69 $sitemap_entry['lastmod'] = wp_date( DATE_W3C, time() ); 70 71 return $sitemap_entry; 72 } 73 74 /** 66 75 * Tests that sticky posts are not moved to the front of the first page of the post sitemap. 67 76 * 68 77 * @ticket 55633 69 78 */ 70 public function test_posts_sticky_posts () {79 public function test_posts_sticky_posts_not_moved_to_front() { 71 80 $factory = self::factory(); 72 81 … … 80 89 $url_list = $posts_provider->get_url_list( 1, 'post' ); 81 90 82 $this->assertCount( count( $post_ids ), $url_list ); 91 $this->assertCount( count( $post_ids ), $url_list, 'The post count did not match.' ); 92 93 $expected = array(); 94 95 foreach ( $post_ids as $post_id ) { 96 $expected[] = array( 'loc' => home_url( "?p={$post_id}" ) ); 97 } 98 83 99 // Check that the URL list is still in the order of the post IDs (i.e., sticky post wasn't moved to the front). 84 foreach ( $post_ids as $idx => $post_id ) { 85 $this->assertSame( array( 'loc' => home_url( "?p={$post_id}" ) ), $url_list[ $idx ] ); 86 } 87 } 88 89 /** 90 * Callback for 'wp_sitemaps_posts_show_on_front_entry' filter. 91 */ 92 public function _show_on_front_entry( $sitemap_entry ) { 93 $sitemap_entry['lastmod'] = wp_date( DATE_W3C, time() ); 94 95 return $sitemap_entry; 100 $this->assertSame( $expected, $url_list, 'The post order did not match.' ); 96 101 } 97 102 }
Note: See TracChangeset
for help on using the changeset viewer.