| | 996 | * @group filter_query |
| | 997 | * @group BP_Activity_Query |
| | 998 | */ |
| | 999 | function test_bp_has_activities_with_filter_query_compare_like_and_apostrophes() { |
| | 1000 | $u1 = $this->factory->user->create(); |
| | 1001 | |
| | 1002 | $now = time(); |
| | 1003 | |
| | 1004 | $a1 = $this->factory->activity->create( array( |
| | 1005 | 'user_id' => $u1, |
| | 1006 | 'component' => 'activity', |
| | 1007 | 'content' => "this isn't a knive", |
| | 1008 | 'item_id' => 1, |
| | 1009 | 'type' => 'activity_update', |
| | 1010 | 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), |
| | 1011 | ) ); |
| | 1012 | |
| | 1013 | // misc activity items |
| | 1014 | $a2 = $this->factory->activity->create( array( |
| | 1015 | 'user_id' => $u1, |
| | 1016 | 'component' => 'activity', |
| | 1017 | 'item_id' => 10, |
| | 1018 | 'type' => 'activity_update', |
| | 1019 | 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), |
| | 1020 | ) ); |
| | 1021 | $a3 = $this->factory->activity->create( array( |
| | 1022 | 'user_id' => $u1, |
| | 1023 | 'component' => 'activity', |
| | 1024 | 'item_id' => 25, |
| | 1025 | 'type' => 'activity_update', |
| | 1026 | 'recorded_time' => date( 'Y-m-d H:i:s', $now - 100 ), |
| | 1027 | ) ); |
| | 1028 | |
| | 1029 | global $activities_template; |
| | 1030 | |
| | 1031 | bp_has_activities( array( |
| | 1032 | 'filter_query' => array( |
| | 1033 | array( |
| | 1034 | 'column' => 'content', |
| | 1035 | 'value' => "this isn't a knive", |
| | 1036 | 'compare' => 'LIKE', |
| | 1037 | ), |
| | 1038 | ) |
| | 1039 | ) ); |
| | 1040 | |
| | 1041 | // assert! |
| | 1042 | $this->assertEqualSets( array( $a1 ), wp_list_pluck( $activities_template->activities, 'id' ) ); |
| | 1043 | |
| | 1044 | // clean up! |
| | 1045 | $activities_template = null; |
| | 1046 | } |
| | 1047 | |
| | 1048 | /** |