Changeset 35553
- Timestamp:
- 11/06/2015 06:57:53 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r35534 r35553 1303 1303 protected function _cmp_priority( $a, $b ) { 1304 1304 if ( $a->priority === $b->priority ) { 1305 return $a->instance_number - $ a->instance_number;1305 return $a->instance_number - $b->instance_number; 1306 1306 } else { 1307 1307 return $a->priority - $b->priority; -
trunk/tests/phpunit/tests/customize/manager.php
r35483 r35553 398 398 return array( 'nav_menus' ); 399 399 } 400 401 /** 402 * @ticket 30225 403 * @ticket 34594 404 */ 405 function test_prepare_controls_stable_sorting() { 406 $manager = new WP_Customize_Manager(); 407 $manager->register_controls(); 408 $section_id = 'foo-section'; 409 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 410 $manager->add_section( $section_id, array( 411 'title' => 'Section', 412 'priority' => 1, 413 ) ); 414 415 $added_control_ids = array(); 416 $count = 9; 417 for ( $i = 0; $i < $count; $i += 1 ) { 418 $id = 'sort-test-' . $i; 419 $added_control_ids[] = $id; 420 $manager->add_setting( $id ); 421 $control = new WP_Customize_Control( $manager, $id, array( 422 'section' => $section_id, 423 'priority' => 1, 424 'setting' => $id, 425 ) ); 426 $manager->add_control( $control ); 427 } 428 429 $manager->prepare_controls(); 430 431 $sorted_control_ids = wp_list_pluck( $manager->get_section( $section_id )->controls, 'id' ); 432 $this->assertEquals( $added_control_ids, $sorted_control_ids ); 433 } 400 434 }
Note: See TracChangeset
for help on using the changeset viewer.