Invalidate the post cache for posts associated with a user who has been removed from a blog in remove_user_from_blog(). Adds a unit test.

Props nprasath002 for the initial patch.
Fixes #25545.



git-svn-id: https://develop.svn.wordpress.org/trunk@27087 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-02-04 04:12:52 +00:00
parent e07424147c
commit 050e4f26e9
2 changed files with 17 additions and 0 deletions

View File

@@ -25,6 +25,20 @@ class Tests_MS extends WP_UnitTestCase {
$wpdb->suppress_errors( $this->suppress );
}
function test_remove_user_from_blog() {
$user1 = $this->factory->user->create_and_get();
$user2 = $this->factory->user->create_and_get();
$post_id = $this->factory->post->create( array( 'post_author' => $user1->ID ) );
remove_user_from_blog( $user1->ID, 1, $user2->ID );
$post = get_post( $post_id );
$this->assertNotEquals( $user1->ID, $post->post_author );
$this->assertEquals( $user2->ID, $post->post_author );
}
/**
* @ticket 22917
*/