Changeset 39138 for trunk/tests/phpunit/tests/ajax/CustomizeMenus.php
- Timestamp:
- 11/04/2016 07:23:49 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/CustomizeMenus.php
r39137 r39138 323 323 */ 324 324 function test2_ajax_load_available_items_structure( $post_args ) { 325 do_action( 'customize_register', $this->wp_customize ); 325 326 326 327 $expected_keys = array( … … 337 338 self::factory()->term->create_many( 5 ); 338 339 self::factory()->post->create_many( 5, array( 'post_type' => 'page' ) ); 340 $auto_draft_post = $this->wp_customize->nav_menus->insert_auto_draft_post( array( 'post_title' => 'Test Auto Draft', 'post_type' => 'post' ) ); 341 $this->wp_customize->set_post_value( 'nav_menus_created_posts', array( $auto_draft_post->ID ) ); 342 $this->wp_customize->get_setting( 'nav_menus_created_posts' )->preview(); 339 343 340 344 $_POST = array_merge( array( … … 372 376 } 373 377 } 378 } elseif ( 'post' === $test_item['object'] ) { 379 $item_ids = wp_list_pluck( $response['data']['items']['post_type:post'], 'id' ); 380 $this->assertContains( 'post-' . $auto_draft_post->ID, $item_ids ); 374 381 } 375 382 } … … 498 505 */ 499 506 function test_ajax_search_available_items_results( $post_args, $expected_results ) { 507 do_action( 'customize_register', $this->wp_customize ); 500 508 501 509 self::factory()->post->create_many( 5, array( 'post_title' => 'Test Post' ) ); 510 $included_auto_draft_post = $this->wp_customize->nav_menus->insert_auto_draft_post( array( 'post_title' => 'Test Included Auto Draft', 'post_type' => 'post' ) ); 511 $excluded_auto_draft_post = $this->wp_customize->nav_menus->insert_auto_draft_post( array( 'post_title' => 'Excluded Auto Draft', 'post_type' => 'post' ) ); 512 $this->wp_customize->set_post_value( 'nav_menus_created_posts', array( $included_auto_draft_post->ID, $excluded_auto_draft_post->ID ) ); 513 $this->wp_customize->get_setting( 'nav_menus_created_posts' )->preview(); 502 514 503 515 $_POST = array_merge( array( … … 512 524 if ( isset( $post_args['search'] ) && 'test' === $post_args['search'] ) { 513 525 $this->assertsame( true, $response['success'] ); 514 $this->assertSame( 5, count( $response['data']['items'] ) ); 526 $this->assertSame( 6, count( $response['data']['items'] ) ); 527 $item_ids = wp_list_pluck( $response['data']['items'], 'id' ); 528 $this->assertContains( 'post-' . $included_auto_draft_post->ID, $item_ids ); 529 $this->assertNotContains( 'post-' . $excluded_auto_draft_post->ID, $item_ids ); 515 530 } else { 516 531 $this->assertSame( $expected_results, $response ); 517 532 } 518 519 533 } 520 534
Note: See TracChangeset
for help on using the changeset viewer.