Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/27/2014 06:20:37 PM (10 years ago)
Author:
boonebgorges
Message:

Don't allow a user to favorite a single activity item more than once.

Fixes #5478

File:
1 edited

Legend:

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

    r8133 r8175  
    696696    }
    697697
     698    /**
     699     * @group favorites
     700     * @group bp_activity_add_user_favorite
     701     */
     702    public function test_add_user_favorite_already_favorited() {
     703        $u = $this->create_user();
     704        $a = $this->factory->activity->create();
     705
     706        bp_activity_add_user_favorite( $a, $u );
     707
     708        $this->assertFalse( bp_activity_add_user_favorite( $a, $u ) );
     709        $this->assertSame( array( $a ), bp_activity_get_user_favorites( $u ) );
     710        $this->assertEquals( 1, bp_activity_get_meta( $a, 'favorite_count' ) );
     711    }
     712
    698713    public function check_activity_caches() {
    699714        foreach ( $this->acaches as $k => $v ) {
Note: See TracChangeset for help on using the changeset viewer.