Changeset 6939 for trunk/tests/testcases/core/classes.php
- Timestamp:
- 04/22/2013 02:23:15 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/core/classes.php
r6934 r6939 80 80 } 81 81 82 public function test_bp_user_query_include_on_user_page() { 83 $u1 = $this->create_user(); 84 $u2 = $this->create_user(); 85 86 $q = new BP_User_Query( array( 87 // 'user_id' parameter is passed to emulate a displayed user page 88 // @see https://buddypress.trac.wordpress.org/browser/tags/1.7/bp-members/bp-members-template.php#L277 89 'user_id' => $u1, 90 91 // Get all user IDs; we want to return just these IDs 92 'include' => array( $u1, $u2 ), 93 ) ); 94 95 $users = is_array( $q->results ) ? array_values( $q->results ) : array(); 96 $user_ids = wp_list_pluck( $users, 'ID' ); 97 $this->assertEquals( $user_ids, array( $u2, $u1 ) ); 98 } 99 100 public function test_bp_user_query_friendship_requests() { 101 $u1 = $this->create_user(); 102 $u2 = $this->create_user(); 103 104 friends_add_friend( $u1, $u2 ); 105 106 // emulate bp_has_members( 'type=alphabetical&include=' . bp_get_friendship_requests() ) 107 $q = new BP_User_Query( array( 108 // 'user_id' parameter is passed to emulate a displayed user page 109 // @see https://buddypress.trac.wordpress.org/browser/tags/1.7/bp-members/bp-members-template.php#L277 110 'user_id' => $u2, 111 112 // get friendship requests for $u2 113 'include' => bp_get_friendship_requests( $u2 ), 114 ) ); 115 116 $requests = is_array( $q->results ) ? array_values( $q->results ) : array(); 117 $request_ids = wp_list_pluck( $requests, 'ID' ); 118 $this->assertEquals( $request_ids, array( $u1 ) ); 119 } 82 120 }
Note: See TracChangeset
for help on using the changeset viewer.