- Timestamp:
- 11/07/2022 08:53:18 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/updatePostsCount.php
r54760 r54762 22 22 */ 23 23 public function test_update_posts_count() { 24 $blog_id = self::factory()->blog->create(); 25 switch_to_blog( $blog_id ); 26 24 27 $original_post_count = (int) get_site()->post_count; 25 28 26 29 $post_id = self::factory()->post->create(); 30 31 $post_count_after_creating = get_site()->post_count; 32 33 wp_delete_post( $post_id ); 34 35 $post_count_after_deleting = get_site()->post_count; 36 37 restore_current_blog(); 27 38 28 39 /* … … 33 44 * which then calls update_posts_count() to update the count. 34 45 */ 35 $this->assertSame( $original_post_count + 1, get_site()->post_count, 'Post count should be incremented by 1.' ); 36 37 wp_delete_post( $post_id ); 46 $this->assertSame( $original_post_count + 1, $post_count_after_creating, 'Post count should be incremented by 1.' ); 38 47 39 48 /* … … 44 53 * which then calls update_posts_count() to update the count. 45 54 */ 46 $this->assertSame( $original_post_count, get_site()->post_count, 'Post count should match the original count.' );55 $this->assertSame( $original_post_count, $post_count_after_deleting, 'Post count should match the original count.' ); 47 56 } 48 57 }
Note: See TracChangeset
for help on using the changeset viewer.