| 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 |