WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/04/2014 04:12:52 AM (6 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ms.php

    r26252 r27087  
    2424        parent::tearDown();
    2525        $wpdb->suppress_errors( $this->suppress );
     26    }
     27
     28    function test_remove_user_from_blog() {
     29        $user1 = $this->factory->user->create_and_get();
     30        $user2 = $this->factory->user->create_and_get();
     31
     32        $post_id = $this->factory->post->create( array( 'post_author' => $user1->ID ) );
     33
     34        remove_user_from_blog( $user1->ID, 1, $user2->ID );
     35
     36        $post = get_post( $post_id );
     37
     38        $this->assertNotEquals( $user1->ID, $post->post_author );
     39        $this->assertEquals( $user2->ID, $post->post_author );
    2640    }
    2741
Note: See TracChangeset for help on using the changeset viewer.