Changeset 7008 for trunk/tests/testcases/core/classes.php
- Timestamp:
- 05/06/2013 07:51:30 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/tests/testcases/core/classes.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/core/classes.php
r6996 r7008 101 101 $this->assertEquals( $expected, $user_ids ); 102 102 } 103 104 public function test_bp_user_query_search_with_apostrophe() { 105 // Apostrophe. Search_terms must escaped to mimic POST payload 106 $user_id = $this->create_user(); 107 xprofile_set_field_data( 1, $user_id, "Foo'Bar" ); 108 $q = new BP_User_Query( array( 'search_terms' => "oo\'Ba", ) ); 109 110 $found_user_id = null; 111 if ( ! empty( $q->results ) ) { 112 $found_user = array_pop( $q->results ); 113 $found_user_id = $found_user->ID; 114 } 115 116 $this->assertEquals( $user_id, $found_user_id ); 117 } 118 119 public function test_bp_user_query_search_with_percent_sign() { 120 121 // LIKE special character: % 122 $user_id = $this->create_user(); 123 xprofile_set_field_data( 1, $user_id, "Foo%Bar" ); 124 $q = new BP_User_Query( array( 'search_terms' => "oo%Bar", ) ); 125 126 $found_user_id = null; 127 if ( ! empty( $q->results ) ) { 128 $found_user = array_pop( $q->results ); 129 $found_user_id = $found_user->ID; 130 } 131 132 $this->assertEquals( $user_id, $found_user_id ); 133 134 } 135 136 public function test_bp_user_query_search_with_underscore() { 137 138 // LIKE special character: _ 139 $user_id = $this->create_user(); 140 xprofile_set_field_data( 1, $user_id, "Foo_Bar" ); 141 $q = new BP_User_Query( array( 'search_terms' => "oo_Bar", ) ); 142 143 $found_user_id = null; 144 if ( ! empty( $q->results ) ) { 145 $found_user = array_pop( $q->results ); 146 $found_user_id = $found_user->ID; 147 } 148 149 $this->assertEquals( $user_id, $found_user_id ); 150 151 } 152 103 153 }
Note: See TracChangeset
for help on using the changeset viewer.