Changeset 9021
- Timestamp:
- 09/15/2014 04:21:47 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/groups/class-bp-groups-group.php
r8958 r9021 175 175 * @group get 176 176 * @group group_meta_query 177 * @ticket BP5874 178 */ 179 public function test_get_with_meta_query_multiple_clauses_relation_or_shared_meta_key() { 180 $now = time(); 181 $g1 = $this->factory->group->create( array( 182 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60 ), 183 ) ); 184 $g2 = $this->factory->group->create( array( 185 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60*2 ), 186 ) ); 187 $g3 = $this->factory->group->create( array( 188 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60*3 ), 189 ) ); 190 groups_update_groupmeta( $g1, 'foo', 'bar' ); 191 groups_update_groupmeta( $g2, 'foo', 'baz' ); 192 groups_update_groupmeta( $g3, 'foo', 'barry' ); 193 194 $groups = BP_Groups_Group::get( array( 195 'meta_query' => array( 196 'relation' => 'OR', 197 array( 198 'key' => 'foo', 199 'value' => 'bar', 200 ), 201 array( 202 'key' => 'foo', 203 'value' => 'baz', 204 ), 205 ), 206 ) ); 207 $ids = wp_list_pluck( $groups['groups'], 'id' ); 208 $this->assertEquals( array( $g1, $g2 ), $ids ); 209 $this->assertEquals( 2, $groups['total'] ); 210 } 211 212 /** 213 * @group get 214 * @group group_meta_query 215 * @ticket BP5874 216 */ 217 public function test_get_with_meta_query_multiple_clauses_relation_or_shared_meta_key_relation_like() { 218 $now = time(); 219 $g1 = $this->factory->group->create( array( 220 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60 ), 221 ) ); 222 $g2 = $this->factory->group->create( array( 223 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60*2 ), 224 ) ); 225 $g3 = $this->factory->group->create( array( 226 'last_activity' => date( 'Y-m-d H:i:s', $now - 60*60*3 ), 227 ) ); 228 groups_update_groupmeta( $g1, 'foo', 'bar' ); 229 groups_update_groupmeta( $g2, 'foo', 'baz' ); 230 groups_update_groupmeta( $g3, 'foo', 'barry' ); 231 232 $groups = BP_Groups_Group::get( array( 233 'meta_query' => array( 234 'relation' => 'OR', 235 array( 236 'key' => 'foo', 237 'value' => 'bar', 238 'compare' => 'LIKE', 239 ), 240 array( 241 'key' => 'foo', 242 'value' => 'baz', 243 'compare' => 'LIKE', 244 ), 245 ), 246 ) ); 247 $ids = wp_list_pluck( $groups['groups'], 'id' ); 248 $this->assertEquals( array( $g1, $g2 ), $ids ); 249 $this->assertEquals( 2, $groups['total'] ); 250 } 251 252 /** 253 * @group get 254 * @group group_meta_query 177 255 * @ticket BP5824 178 256 */
Note: See TracChangeset
for help on using the changeset viewer.