Changeset 53548 for trunk/tests/phpunit/tests/sitemaps/wpSitemapsPosts.php
- Timestamp:
- 06/21/2022 01:16:10 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/sitemaps/wpSitemapsPosts.php
r51492 r53548 64 64 65 65 /** 66 * Tests that sticky posts are not moved to the front of the first page of the post sitemap. 67 * 68 * @ticket 55633 69 */ 70 public function test_posts_sticky_posts() { 71 $factory = self::factory(); 72 73 // Create 4 posts, and stick the last one. 74 $post_ids = $factory->post->create_many( 4 ); 75 $last_post_id = end( $post_ids ); 76 stick_post( $last_post_id ); 77 78 $posts_provider = new WP_Sitemaps_Posts(); 79 80 $url_list = $posts_provider->get_url_list( 1, 'post' ); 81 82 $this->assertCount( count( $post_ids ), $url_list ); 83 // 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 /** 66 90 * Callback for 'wp_sitemaps_posts_show_on_front_entry' filter. 67 91 */
Note: See TracChangeset
for help on using the changeset viewer.