Changeset 11082 for trunk/tests/phpunit/testcases/core/functions.php
- Timestamp:
- 09/10/2016 05:14:34 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/functions.php
r11019 r11082 427 427 428 428 $this->assertEquals( $expected, bp_alpha_sort_by_key( $items, 'name' ) ); 429 } 430 431 /** 432 * @group bp_sort_by_key 433 */ 434 public function test_bp_sort_by_key_arrays_num_preserve_keys() { 435 $items = array( 436 'p' => array( 437 'foo' => 'bar', 438 'value' => 5, 439 ), 440 'q' => array( 441 'foo' => 'bar', 442 'value' => 10, 443 ), 444 'r' => array( 445 'foo' => 'bar', 446 'value' => 1, 447 ), 448 ); 449 450 $expected = array( 451 'r' => array( 452 'foo' => 'bar', 453 'value' => 1, 454 ), 455 'p' => array( 456 'foo' => 'bar', 457 'value' => 5, 458 ), 459 'q' => array( 460 'foo' => 'bar', 461 'value' => 10, 462 ), 463 ); 464 465 $this->assertEquals( $expected, bp_sort_by_key( $items, 'value', 'num', true ) ); 466 } 467 468 /** 469 * @group bp_sort_by_key 470 */ 471 public function test_bp_sort_by_key_num_should_respect_0_preserve_keys() { 472 $items = array( 473 's' => array( 474 'foo' => 'bar', 475 'value' => 2, 476 ), 477 't' => array( 478 'foo' => 'bar', 479 'value' => 0, 480 ), 481 'u' => array( 482 'foo' => 'bar', 483 'value' => 4, 484 ), 485 ); 486 487 $expected = array( 488 't' => array( 489 'foo' => 'bar', 490 'value' => 0, 491 ), 492 's' => array( 493 'foo' => 'bar', 494 'value' => 2, 495 ), 496 'u' => array( 497 'foo' => 'bar', 498 'value' => 4, 499 ), 500 ); 501 502 $this->assertEquals( $expected, bp_sort_by_key( $items, 'value', 'num', true ) ); 429 503 } 430 504
Note: See TracChangeset
for help on using the changeset viewer.