Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/08/2014 05:55:58 PM (9 years ago)
Author:
r-a-y
Message:

Activity: Purge comment cache when an activity comment is deleted.

Fixes issues with object caching holding deleted activity comments.
Commit also includes a unit test.

Fixes #5863.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/activity/functions.php

    r8958 r8990  
    697697
    698698    /**
     699     * @group bp_activity_delete_comment
     700     * @group cache
     701     */
     702    public function test_bp_activity_delete_comment_clear_cache() {
     703        // add new activity update and comment to this update
     704        $a1 = $this->factory->activity->create();
     705        $a2 = bp_activity_new_comment( array(
     706            'activity_id' => $a1,
     707            'parent_id' => $a1,
     708            'content' => 'foo',
     709            'user_id' => 1,
     710        ) );
     711
     712        // prime cache
     713        bp_activity_get( array(
     714            'in' => array( $a1 ),
     715            'display_comments' => 'threaded',
     716        ) );
     717
     718        // delete activity comment
     719        bp_activity_delete_comment( $a1, $a2 );
     720
     721        // assert comment cache as empty for $a1
     722        $this->assertEmpty( wp_cache_get( $a1, 'bp_activity_comments' ) );
     723    }
     724
     725    /**
    699726     * @group favorites
    700727     * @group bp_activity_add_user_favorite
Note: See TracChangeset for help on using the changeset viewer.