Changeset 47747
- Timestamp:
- 05/02/2020 10:34:50 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r47557 r47747 114 114 'name__like' => $query, 115 115 'number' => 10, 116 'hide_empty' => false, 116 117 ) 117 118 ); -
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r47383 r47747 370 370 'name__like' => $args['s'], 371 371 'number' => 20, 372 'hide_empty' => false, 372 373 'offset' => 20 * ( $args['pagenum'] - 1 ), 373 374 ) -
trunk/tests/phpunit/tests/customize/nav-menus.php
r46586 r47747 372 372 ) 373 373 ); 374 $this->assert Equals( 1, count( $results ) );374 $this->assertCount( 2, $results ); // Category terms Cats Drool and Uncategorized. 375 375 $count = $this->filter_count_customize_nav_menu_searched_items; 376 376 add_filter( 'customize_nav_menu_searched_items', array( $this, 'filter_search' ), 10, 2 ); … … 383 383 $this->assertEquals( $count + 1, $this->filter_count_customize_nav_menu_searched_items ); 384 384 $this->assertInternalType( 'array', $results ); 385 $this->assert Equals( 2, count( $results ));385 $this->assertCount( 3, $results ); 386 386 remove_filter( 'customize_nav_menu_searched_items', array( $this, 'filter_search' ), 10 ); 387 387 … … 397 397 $this->assertEquals( 'home', $results[0]['id'] ); 398 398 $this->assertEquals( 'custom', $results[0]['type'] ); 399 } 400 401 /* 402 * Tests that the search_available_items_query method should return term items 403 * not assigned to any posts. 404 * 405 * @ticket 45298 406 */ 407 public function test_search_available_items_query_should_return_unassigned_term_items() { 408 $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); 409 410 register_taxonomy( 411 'wptests_tax', 412 'post', 413 array( 414 'labels' => array( 415 'name' => 'Tests Taxonomy', 416 ), 417 ) 418 ); 419 420 $term_id = $this->factory->term->create( 421 array( 422 'taxonomy' => 'wptests_tax', 423 'name' => 'foobar', 424 ) 425 ); 426 427 // Expected menu item array. 428 $expected = array( 429 'title' => 'foobar', 430 'id' => "term-{$term_id}", 431 'type' => 'taxonomy', 432 'type_label' => 'Tests Taxonomy', 433 'object' => 'wptests_tax', 434 'object_id' => intval( $term_id ), 435 'url' => get_term_link( intval( $term_id ), '' ), 436 ); 437 438 $results = $menus->search_available_items_query( 439 array( 440 'pagenum' => 1, 441 's' => 'foo', 442 ) 443 ); 444 445 $this->assertEqualSets( $expected, $results[0] ); 399 446 } 400 447 -
trunk/tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php
r47200 r47747 121 121 $this->assertCount( 1, $results ); 122 122 } 123 124 /** 125 * Test that search displays terms that are not assigned to any posts. 126 * 127 * @ticket 45298 128 */ 129 public function test_search_should_return_unassigned_term_items() { 130 register_taxonomy( 'wptests_tax', 'post' ); 131 132 $this->factory->term->create( 133 array( 134 'taxonomy' => 'wptests_tax', 135 'name' => 'foobar', 136 ) 137 ); 138 139 $request = array( 140 'type' => 'quick-search-taxonomy-wptests_tax', 141 'q' => 'foobar', 142 ); 143 $output = get_echo( '_wp_ajax_menu_quick_search', array( $request ) ); 144 145 $this->assertNotEmpty( $output ); 146 $results = explode( "\n", trim( $output ) ); 147 $this->assertCount( 1, $results ); 148 } 123 149 }
Note: See TracChangeset
for help on using the changeset viewer.