mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Change the default orderby value in wp_get_nav_menus() to 'name'.
props voldemortensen, igmoweb. fixes #29460. git-svn-id: https://develop.svn.wordpress.org/trunk@29792 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -116,4 +116,27 @@ class Test_Nav_Menus extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'WordPress.org', $custom_item->title );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 29460
|
||||
*/
|
||||
function test_orderby_name_by_default() {
|
||||
// We are going to create a random number of menus (min 2, max 10)
|
||||
$menus_no = rand( 2, 10 );
|
||||
|
||||
for ( $i = 0; $i <= $menus_no; $i++ ) {
|
||||
wp_create_nav_menu( rand_str() );
|
||||
}
|
||||
|
||||
// This is the expected array of menu names
|
||||
$expected_nav_menus_names = wp_list_pluck(
|
||||
get_terms( 'nav_menu', array( 'hide_empty' => false, 'orderby' => 'name' ) ),
|
||||
'name'
|
||||
);
|
||||
|
||||
// And this is what we got when calling wp_get_nav_menus()
|
||||
$nav_menus_names = wp_list_pluck( wp_get_nav_menus(), 'name' );
|
||||
|
||||
$this->assertEquals( $nav_menus_names, $expected_nav_menus_names );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user