Changeset 9192
- Timestamp:
- 11/26/2014 08:11:57 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r9191 r9192 118 118 } 119 119 120 if ( $values[0] && $values[1]) {120 if ( isset( $values[0], $values[1] ) ) { 121 121 if ( "num" === "' . $type . '" ) { 122 122 $cmp = $values[0] - $values[1]; -
trunk/tests/phpunit/testcases/core/functions.php
r9191 r9192 255 255 $this->assertEquals( $expected, bp_sort_by_key( $items, 'value', 'num' ) ); 256 256 } 257 258 /** 259 * @group bp_sort_by_key 260 */ 261 public function test_bp_sort_by_key_num_should_respect_0() { 262 $items = array( 263 array( 264 'foo' => 'bar', 265 'value' => 2, 266 ), 267 array( 268 'foo' => 'bar', 269 'value' => 0, 270 ), 271 array( 272 'foo' => 'bar', 273 'value' => 4, 274 ), 275 ); 276 277 $expected = array( 278 array( 279 'foo' => 'bar', 280 'value' => 0, 281 ), 282 array( 283 'foo' => 'bar', 284 'value' => 2, 285 ), 286 array( 287 'foo' => 'bar', 288 'value' => 4, 289 ), 290 ); 291 292 $this->assertEquals( $expected, bp_sort_by_key( $items, 'value', 'num' ) ); 293 } 294 257 295 /** 258 296 * @group bp_alpha_sort_by_key
Note: See TracChangeset
for help on using the changeset viewer.