Changeset 47747 for trunk/tests/phpunit/tests/customize/nav-menus.php
- Timestamp:
- 05/02/2020 10:34:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.