Changeset 6926
- Timestamp:
- 04/19/2013 08:37:02 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
bp-activity/bp-activity-template.php (modified) (1 diff)
-
tests/testcases/activity/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-template.php
r6904 r6926 411 411 return false; 412 412 413 $in clude= implode( ',', (array) $favs );413 $in = implode( ',', (array) $favs ); 414 414 $display_comments = true; 415 $user_id = 0; 415 416 break; 416 417 case 'mentions': -
trunk/tests/testcases/activity/template.php
r6907 r6926 57 57 } 58 58 59 60 /** 61 * Make sure that action filters ('activity_update', etc) work when 62 * limiting query to user favorites 63 * 64 * @ticket BP4872 65 */ 66 public function test_bp_has_activities_favorites_action_filter() { 67 $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) ); 68 69 $a1 = $this->factory->activity->create( array( 70 'type' => 'activity_update', 71 ) ); 72 73 $a2 = $this->factory->activity->create( array( 74 'type' => 'joined_group', 75 ) ); 76 77 bp_activity_add_user_favorite( $a1->id, $user_id ); 78 bp_activity_add_user_favorite( $a2->id, $user_id ); 79 80 // groan. It sucks that you have to invoke the global 81 global $activities_template; 82 83 // Case 1: no action filter 84 bp_has_activities( array( 85 'user_id' => $user_id, 86 'scope' => 'favorites', 87 ) ); 88 89 // The formatting of $activities_template->activities is messed 90 // up, so we're just going to look at the IDs. This should be 91 // fixed in BP at some point 92 $ids = wp_list_pluck( $activities_template->activities, 'id' ); 93 94 $this->assertEquals( $ids, array( $a1->id, $a2->id ) ); 95 96 $activities_template = null; 97 98 // Case 2: action filter 99 bp_has_activities( array( 100 'user_id' => $user_id, 101 'scope' => 'favorites', 102 'action' => 'activity_update', 103 ) ); 104 105 global $wpdb, $bp; 106 107 $ids = wp_list_pluck( $activities_template->activities, 'id' ); 108 109 $this->assertEquals( $ids, array( $a1->id ) ); 110 111 $activities_template = null; 112 } 59 113 }
Note: See TracChangeset
for help on using the changeset viewer.