Changeset 9191 for trunk/tests/phpunit/testcases/core/functions.php
- Timestamp:
- 11/26/2014 06:21:42 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/functions.php
r9180 r9191 188 188 } 189 189 190 /** 191 * @group bp_sort_by_key 192 */ 193 public function test_bp_sort_by_key_arrays_num() { 194 $items = array( 195 array( 196 'foo' => 'bar', 197 'value' => 5, 198 ), 199 array( 200 'foo' => 'bar', 201 'value' => 10, 202 ), 203 array( 204 'foo' => 'bar', 205 'value' => 1, 206 ), 207 ); 208 209 $expected = array( 210 array( 211 'foo' => 'bar', 212 'value' => 1, 213 ), 214 array( 215 'foo' => 'bar', 216 'value' => 5, 217 ), 218 array( 219 'foo' => 'bar', 220 'value' => 10, 221 ), 222 ); 223 224 $this->assertEquals( $expected, bp_sort_by_key( $items, 'value', 'num' ) ); 225 } 226 227 /** 228 * @group bp_sort_by_key 229 */ 230 public function test_bp_sort_by_key_objects_num() { 231 $items = array( 232 new stdClass, 233 new stdClass, 234 new stdClass, 235 ); 236 $items[0]->foo = 'bar'; 237 $items[0]->value = 5; 238 $items[1]->foo = 'bar'; 239 $items[1]->value = 10; 240 $items[2]->foo = 'bar'; 241 $items[2]->value = 1; 242 243 $expected = array( 244 new stdClass, 245 new stdClass, 246 new stdClass, 247 ); 248 $expected[0]->foo = 'bar'; 249 $expected[0]->value = 1; 250 $expected[1]->foo = 'bar'; 251 $expected[1]->value = 5; 252 $expected[2]->foo = 'bar'; 253 $expected[2]->value = 10; 254 255 $this->assertEquals( $expected, bp_sort_by_key( $items, 'value', 'num' ) ); 256 } 190 257 /** 191 258 * @group bp_alpha_sort_by_key
Note: See TracChangeset
for help on using the changeset viewer.